Modal PopUp extender Works intermittent [Resolved]

Posted by Sharpcnet under ASP.NET AJAX on 12/3/2013 | Points: 10 | Views : 25935 | Status : [Member] | Replies : 4
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();
}





Responses

Posted by: Sharpcnet on: 12/5/2013 [Member] Starter | Points: 25

Up
0
Down

Resolved
Thank you all for the responses. I found out the culprit. It was the modal's close button. By default it does not have any code. It just closes the modal when we click on it. I belive it wasnt doing its thing all right. I just added mpe.hide(); for its Click event at server side and it works all ok now.

By The way, the modal opens or closes with a delay of 1s/2s. It is normal?

Sharpcnet, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: vishalneeraj-24503 on: 12/3/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Please update your update panel as
updatepanel1.Update();

and try.

Sharpcnet, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: vishalneeraj-24503 on: 12/3/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
Also refer:-

http://www.aspdotnet-suresh.com/2011/03/how-to-show-modalpopup-to-edit-gridview.html
http://www.asp.net/ajaxlibrary/ajaxcontroltoolkitsamplesite/modalpopup/modalpopup.aspx
http://www.codeproject.com/Articles/34996/ASP-NET-AJAX-Control-Toolkit-ModalPopupExtender-Co

Sharpcnet, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response