I have an imagebutton column in a gridview. Clicking on the image will show the ModalPopUp.
When the page loads the first time, it works fine. But once when I close the popup and click on the image again, the popup doesnt show. I have to click it a second time to show.
Why does this happen.
I executed in debug mode and found this. When the page first loads and I click on the image, it executes the view() function and shows the popup. Once the popup is closed and again the image is clicked, its not coming to the view() at all. But I click a second time, it works again.
ASPX:
<asp:UpdatePanel runat="server" updatemode="conditional">
<Triggers>
<asp:asyncpostbacktrigger controlid="gvXml" eventname="rowcommand"/>
</Triggers>
<Contenttemplate>
<asp:GridView ID="gvXml" runat="server">
<Columns>
<asp:TemplateField HeaderText = "VIEW">
<ItemTemplate>
<asp:Imagebutton id="btnView" runat="server" CommandName="View"
CommandArgument='<%#Eval("Id")%>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Link id="lnkFake" runat="server" >
<asp:ModalPopUpExtender ID="mpe" runat="server" PopupControlID="pnlModal"
TargetControlID="lnkFake" CancelControlID="btnClose" BackgroundCssClass="modalBackground">
</asp:ModalPopUpExtender>
<asp:panel id="pnlModal" runat="server" cssclass="modalOuter" style="display:none">
<asp:imagebutton id="btnclose" runat="server" cssclass="closeIcon" imageurl="~Images/close.png"
width="30px" height="30px">
<div class="modalInner">
<asp:gridview id="gvModal" runat="server"></asp:gridview>
</div>
</asp:panel>
</Contenttemplate>
</asp:updatepanel>
CS:
protected void View (object sender, CommandEventArgs e)
{
gvModal.DataSource = dt;
gvModal.DataBind();
mpe.Show();
}