0

I am making a basic ticketing system in C# with basic coding experience. Most of my experience is in SQL.

I have the database and tables. I have stored procedures to create and amend tickets.

I am stuck (this is probably very basic) because:

  1. On my EDIT ticket page, I populate various text boxes and drop downs from my existing data via inline SQL.

  2. On my page, I can edit all the fields and dropdowns with new values. (i.e. change a ticket priority from when it was first logged)

  3. I have a button, that calls my "update" stored procedure, however it updates only the NEW fields I have, any amendments to the existing fields are overwritten by the original values before submitting.

The original values are called on pageload, so I think the button reloads the page before submitting. I want it to submit all the values that are on the screen.

I think this must be something obvious, remember I am a novice so I may have missed something simple.

1 Answer 1

1

If what you're saying is you load values from the DB into the form controls in the PageLoad event handler, then yes, you're probably overwriting the changed values. To keep things as simple as possible for you, wrap the original values loading code in the following:

if( !IsPostBack )
{
   // load initial form values here from DB
}

I'd suggest you read about the ASP.NET page lifecycle: http://msdn.microsoft.com/en-us/library/ms178472(v=vs.90).aspx

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you very much, that appears to have worked in my tests. I will report back when I have got it working later today.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.