Note that there are some explanatory texts on larger screens.

plurals
  1. POajax modalpopupextender not triggered from code behind
    primarykey
    data
    text
    <p>I would like to display a modal popup in code behind once the button is clicked, operation executed and next thing would be to display the modal popup. I have modalpopupextender, popup, button which is set to display:none, so the modal popup does not throw an error. I have imagebutton in a gridview from which I am triggering action in the code behind, and once the action is executed I would like the modal popup to be displayed. So, I've been battling with this issue for the last 2-3 hours and I decided to put a post here and someone might help. This is what I have. Markup:</p> <pre><code>&lt;%@ Page Language="C#" MasterPageFile="~/EmployerMasterPage.master" AutoEventWireup="true" CodeFile="JobPostingList.aspx.cs" Inherits="Employer_JobPostingList" ValidateRequest="false" %&gt; &lt;asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server"&gt; &lt;div id="emplhelp"&gt; &lt;table cellspacing="0" cellpadding="0" class="cdiv1 border_none"&gt; &lt;tr&gt; &lt;td valign="top"&gt; &lt;table cellpadding="0" cellspacing="0" class="grayborder subtblE"&gt; &lt;tr&gt; &lt;td class="pad_grid"&gt; &lt;asp:GridView ID="GridView1" class="grdtxt gridvw" runat="server" AutoGenerateColumns="False" AllowPaging="True" PageSize="20" DataKeyNames="PostingID" BackColor="White" BorderColor="Gray" BorderStyle="Solid" Width="100%" BorderWidth="1" CellPadding="3" GridLines="Vertical" EmptyDataText="No Results." OnDataBound="GridView1_DataBound" OnPageIndexChanging="GridView1_PageIndexChanging"&gt; &lt;Columns&gt; &lt;asp:BoundField DataField="Location" HeaderText="Location" /&gt; &lt;asp:BoundField DataField="PostingStatus2" HeaderText="Posting Status" ItemStyle-HorizontalAlign="center" /&gt; &lt;asp:BoundField DataField="DatePosted" HeaderText="Date Posted" DataFormatString="{0:dd/MMM/yyy}" HtmlEncode="false" ItemStyle-HorizontalAlign="Center" /&gt; &lt;asp:TemplateField HeaderText="Edit" ItemStyle-HorizontalAlign="Center"&gt; &lt;ItemTemplate&gt; &lt;asp:ImageButton ID="imgButton1" RowIndex='&lt;%# Eval("PostingID") %&gt;' OnClick="imgButton1_Click" runat="server" ImageUrl="/images/a.png" /&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &amp;nbsp; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;asp:Button ID="btnShowPopup" runat="server" style="display:none" /&gt; &lt;/div&gt; &lt;!-- LOGIN PANEL --&gt; &lt;asp:Panel ID="pnlConfirm" runat="server" CssClass="modalPanel" Style="display: none; height:160px;"&gt; &lt;div&gt; &lt;table class="featrEmpDivLoginPopup" style="height:160px; width:460px;" cellspacing="0" cellpadding="0"&gt; &lt;tr&gt; &lt;td id="divClose" runat="server" class="topimglhs533 hedding1" style="height:30px; background-color:#d3d8d2;"&gt; Message &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt; &lt;div id="jsAlert1_popupBody" style="position: absolute; font-family: Verdana,Arial; font-size: 9pt; padding: 2px; text-align: left; background-color: rgb(255, 255, 255); color: black; top: 34px; width: 450px; left: 1px;"&gt; &lt;div style="padding-left:25px; padding-right:25px; padding-top:5px; padding-bottom:5px;"&gt;Are you sure you want to Archive this posting?&lt;br&gt;&lt;/div&gt; &lt;/div&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td style="width:100px; margin-top:5px; padding-left:50px;"&gt; &lt;asp:ImageButton ID="btnUpdate" ImageUrl="~/Images/btnarchive.jpg" OnClick="btnUpdate_Click" runat="server" /&gt; &lt;asp:ImageButton ID="btnCancel" ImageUrl="~/Images/cancel.jpg" runat="server" /&gt; &lt;asp:HiddenField ID="hfPostingID" runat="server" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;/asp:Panel&gt; &lt;ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="btnShowPopup" PopupControlID="pnlConfirm" CancelControlID="btnCancel" BackgroundCssClass="modalBackground"&gt; &lt;/ajaxToolkit:ModalPopupExtender&gt; &lt;!-- LOGIN PANEL --&gt; &lt;/asp:Content&gt; </code></pre> <p>And then in the code behind I have this:</p> <pre><code>protected void imgButton1_Click(object sender, ImageClickEventArgs e) { ImageButton btndetails = sender as ImageButton; GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer; string postingID = btndetails.Attributes["RowIndex"]; if (postingID != string.Empty) { hfPostingID.Value = postingID; } ModalPopupExtender1.Show(); // this.ModalPopupExtender1.Show(); } </code></pre> <p>As you can see I tried both this.ModalPopupExtender1 and ModalPopupExtender but I am getting the same response. Answer is greatly appreciated. Thanks in advance, Laziale</p> <p>No one can help me? :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload