Order Entry/Edit Design Question

Jackled

New Member
I'm doing a common order entry/edit form. If the order <BR>number combo box is "*" it is a new entry, but if the user <BR>selects an existing order to edit I want to repopulate the <BR>data from the database. That was working fine with <BR>Page_Load checking for the isPostBack condition. However, <BR>if the user CHANGES some data and clicks "Submit", it's <BR>again firing the PageLoad thus overwriting the user's <BR>changes.<BR><BR>What's the best way to do this? <BR>Thanks,<BR>DeannaThis is how I have handled it. I'd say the best way to resolve this is to create a sub like this and all buttons that will run code.<BR>Public Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click<BR><BR>'call another sub that populates form the db<BR>'GetMainData()<BR><BR>End SubAre you saying I should remove the AutoPostback from the submit button? How can I do that?<BR><BR>Can GetMainData redraw the page without a postback?<BR><BR>Thanks,<BR>DeannaOk, here's how I do it.<BR><BR>in the Page_Load() I have this:<BR><BR>If Not IsPostBack then<BR> 'go get my data from the db<BR> GetMainData()<BR>End If<BR><BR>And I have a separate sub routine (like the one I earlier described) for each button. That way the button event will run and it won't run through your Page_Load. Even though each sub will call the same GetMainData you have trapped the individual events. It seems to work quite well from what I've done so far. You will most likely NOT have very much code in your Page_Load routine because as I've pointed out each button/control can have it's own routine.<BR>Hope that helps.<BR>:-)As my 10 year old would say ... "Duh". That approach works perfectly. Sorry I was so dense earlier. There's so much to learn here and I'm on a really tight schedule as usual.<BR><BR>Thanks again!<BR>Deanna
 
Back
Top