c# - update panel inside jquery dialog div not working -
this question has answer here:
- jquery ui dialog asp.net button postback 17 answers
that's code :
<div id="addfrienddiv" style="display: none"> <asp:textbox id="friendparamtxt" runat="server"></asp:textbox> <asp:updatepanel id="upd" runat="server"> <triggers> <asp:asyncpostbacktrigger controlid="searchfriend_btn" eventname="click" /> </triggers> <contenttemplate> <asp:button id="searchfriend_btn" runat="server" onclick="searchfriend_btn_click" value="search" /> <asp:repeater id="friendrequestrepeater" runat="server"> <itemtemplate> <table border="1"> <tr> <td> <img src='<%#eval("profile_pic") %>' width="35px" height="35px" alt='<%#eval("name") %>' /> </td> <td> <asp:label id="name_lbl" runat="server" text='<%#eval("name") %>'></asp:label> </td> <td> <input type="hidden" id="requestfriendid_hf" /><input type="button" id="addfreind" value="send request" /> </td> </tr> </table> </itemtemplate> </asp:repeater> </contenttemplate> </asp:updatepanel> </div>
client side :
function sendfriendrequest() { var dialogoption = { title: "<u>add friend</u>", width: 280, height: 140, modal: false, resizable: false, draggable: true, maxheight: 340, autoopen: true, closeonescape: true }; var dialogextendoptions = { "close": true, "maximize": false, "minimize": true, "dblclick": 'minimize', "titlebar": 'transparent' }; $("#addfrienddiv").dialog(dialogoption).dialogextend(dialogextendoptions); $("#addfrienddiv").show(); }
server side :
protected void searchfriend_btn_click(object sender, eventargs e) { datatable frdrequest= new datatable(); int clientid =int.parse( userid.value.tostring()); if (friendparamtxt.text != "") { frdrequest = sqlhelper.getallclientbyparam(friendparamtxt.text, clientid); if (frdrequest.rows.count > 0) { friendrequestrepeater.datasource = frdrequest; friendrequestrepeater.databind(); } } }
sendfriendrequest beeing called form tag outside problem button click event isn't firing when main div dialog when changed normal div work fine know solution ?
the problem jquery ui appends dialog body, rather form. asp.net controls need inside form in order function, thankfully easy fix. modify jquery so:
$("#addfrienddiv").dialog(dialogoption) .dialogextend(dialogextendoptions) .parent().appendto($("form:first")); $("#addfrienddiv").show();
Comments
Post a Comment