I am having a gridview and I am editing the data in it using ajax modal pop up extender.
When I am clicking the edit button the event is not getting fired the first time.
The event is getting fired only on the 2nd click.
This is my aspx code.
<asp:TemplateField HeaderText="Edit">
<itemtemplate>
<asp:ImageButton ID="imgbtn" ImageUrl="~/image/Edit.jpg" runat="server" Width="25"
Height="25" OnClick="imgbtn_Click" CausesValidation="false" />
This is code for Modal Popup
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnShowPopup"
PopupControlID="pnlpopup" CancelControlID="btnCancel" BackgroundCssClass="modalBackground">
<asp:Panel ID="pnlpopup" runat="server" BackColor="White" Height="269px" Width="400px"
Style="display: none">
cellpadding="0" cellspacing="0">
<tr id="tr1" runat="server" visible="false">
align="center">
Fuel Master
|
UserId:
| <asp:Label ID="lblID" runat="server">
|
Username:
| <asp:TextBox ID="txtfname" runat="server" />
|
| <asp:Button ID="btnUpdate" CommandName="Update" runat="server" Text="Update" OnClick="btnUpdate_Click" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
|
This is my aspx.cs code event for the button click.
protected void imgbtn_Click(object sender, ImageClickEventArgs e)
{
ImageButton btndetails = sender as ImageButton;
GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer;
lblID.Text = gvdetails.DataKeys[gvrow.RowIndex].Value.ToString();
txtfname.Text = gvrow.Cells[1].Text;
this.ModalPopupExtender1.Show();
}
Please help me to fix this issue?