Note that there are some explanatory texts on larger screens.

plurals
  1. POModal Popup not working inside UpdatePanel
    primarykey
    data
    text
    <p>I have a gridview inside UpdatePanel. One of the column in gridview is link which when clicked should display modal (i am using zurb modal <a href="http://www.zurb.com/playground/reveal-modal-plugin" rel="nofollow">http://www.zurb.com/playground/reveal-modal-plugin</a>). The problem is the modal only gets displayed only once when the link is clicked, the next time when the link is clicked it just refreshes the page. The modal should be displayed everytime when the link inside the gridview is clicked.</p> <p><strong>Modal Script:</strong></p> <pre><code>function popupModal() { $("a.link").click(function (e) { e.preventDefault(); $('#myModal #modalContents').load($(this).attr('href')); $('#myModal').reveal(); }); } </code></pre> <p><strong>GridView:</strong></p> <pre><code>&lt;asp:ScriptManager ID="smgr" runat="server" EnablePartialRendering="true" /&gt; &lt;asp:UpdatePanel ID="upnlSearchResults" runat="server" RenderMode="Inline"&gt; &lt;ContentTemplate&gt; &lt;asp:GridView ID="gvResult" runat="server" AutoGenerateColumns="false"&gt; &lt;Columns&gt; &lt;asp:BoundField DataField="EmployeeID" HeaderText="Employee ID" /&gt; &lt;asp:TemplateField HeaderText=""&gt; &lt;ItemTemplate&gt; &lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td colspan="10"&gt; &lt;a href="Department.aspx" class="link"&gt;Detail Information&lt;/a&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt; &lt;/ContentTemplate&gt; &lt;Triggers&gt; &lt;asp:AsyncPostBackTrigger ControlID="btnSearch" /&gt; &lt;/Triggers&gt; &lt;/asp:UpdatePanel&gt; &lt;div id="myModal" class="reveal-modal"&gt; &lt;div id="modalContents"&gt;&lt;/div&gt; &lt;a class="close-reveal-modal"&gt;&amp;#215;&lt;/a&gt; &lt;/div&gt; </code></pre> <p><strong>Code To Bind GridView and Register Modal PopUp</strong></p> <pre><code>protected void btnSearch_Click(object sender, ImageClickEventArgs e) { var results = _presenter.GetEmployers(); gvResult.DataSource = results; gvResult.DataBind(); ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "popUp", "popupModal();", true); } </code></pre> <blockquote> <p>Edit: I tried to debug javascript and the code breaks in line where it reveals the popup</p> <pre><code> function popupModal() { $("a.link").click(function (e) { e.preventDefault(); $('#myModal #modalContents').load($(this).attr('href')); $('#myModal').reveal(); -&gt; [throws error in this line.] }); } </code></pre> <p>Since i am using zurb modal, it consists of jquery.reveal.js file which consists of reveal function. The function popupModal is in my separate js file employee.js. Since the error message is something like this 'Object doesn't support property or method 'reveal' in IE, i am assuming once the popup modal gets displayed for the first time, it can't find the reveal function from the jquery.reveal.js file.</p> </blockquote> <p>Can anyone help me fix this issue?</p> <p>Sanjeev</p>
    singulars
    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.
 

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