Button does not fire on first click but does on second click

Asked By Pranay Singh
20-Nov-09 10:47 AM
Earn up to 0 extra points for answering this tough question.

My button control does not fire on 1st time click but works on 2nd click  though its doing post back in both scenarios.  To add little more insanity to it,  this is happening only when I am calling one particular method in my click event , otherwise it works normally, but on double click its working fine. Any ideas  whats going on and how this can be handled?

this is my code for it but I dont think anything is wrong with my code , its framework thats playing some tricks I guess :(

<asp:Button ID="btnEdit" runat="server" Text="Edit" onclick="btnEdit_Click" OnClientClick="return confirm('Are you sure you want to edit this message?')" />

protected void btnEdit_Click(object sender, EventArgs e)

{

CompanyAlertLogic.UpdateCompanyAlerts(ddlCompanies.SelectedItem.Text, txtShowAlert.Text);

}

  Did you mean to say,

[)ia6l0 iii replied to Pranay Singh
22-Nov-09 05:31 AM
during a postback both the first and second time, it enters the Edit Click function, but does not execute the code?

I presume, stepping thru the events of the page is the only clue through a debugger. Your code does not seem to be dynamic, so there isn't any fault in the markup that you have posted.

Make sure you are not removing the click event handler at any case. 

Create New Account