Heloo everybody
I am having a problem in a web application that i am developing. My web application comprises of several form each having a few buttons at the top of the form e.g ADD, EDIT, SAVE, CANCEL etc. for form operations. I also have a textbox on my form in which user may type RECODE_ID directly and press ENTER to fetch information about that record. Pressing enter causes a post back to the server where in PAGE_LOAD event has been coded as below:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Call InitializePageControls()
Call SwitchDisplayMode(FORM_MODE.FM_INQUIRE) '''''''''''''''''' sets relevant fields + button enabled or disabled
Call SetPermissions() ''''''''''''sets form permission for the user based on his/her rights
Else
If Request.Form("__EVENTTARGET") = "RECORD_ID" Then
LoadRECORD( Request.Form("__EVENTARGUMENT") )
End If
End If
End Sub
Now the problem is that when I enter the RECOR_ID and press ENTER a post back to the server happens which loads RECORD DATA but right after loading the record my ADD BUTTONS click event btnAdd_Click() is also gets called which i don't want as pressing ADD button cause screen control values to re-initialize and hence all the data that was loaded disappears.
NOTE: Upon closer observation I realized that whenever my textbox txtRecordID is in focus, a box is also visible around ADD BUTTON. Moreover, if I generate a post back through a way that doesn't require me to press ENTER in txtRecordID, it works fine.
Can any body suggest me what should I do to prevent ADD BUTTON CLICK event from invoking upon ENTER PRESS in txtRecordID.
Regards,
Zulfiqar Dhuka