Jquery Dialog is not firing when call from the C# code behind -


this .aspx :

 <div id="divaddrcandidates" class="selector"   style="display:none">     <div style="margin-left:10px ; margin-top:10px">         <asp:listbox id="lstcandidates" runat="server" ></asp:listbox>     </div>      <br />              <div style="margin-left:10px">         <asp:button id="btnselect" runat="server" text="select address" />        <asp:button id="btncancel" runat="server" text="cancel" onclick="btncancel_click" onclientclick="closeaddrcandidateswin(); return false;" />     </div> </div>   

this jquery:

    function openaddrcandidateswin() {         $("#divaddrcandidates").dialog({             resizable: true,             width: 650,             heigh: 450,             modal: true,             draggable: true,             resizable: true                         });         $(".selector").dialog({ dialogclass: 'no-close' });         jquery("#divaddrcandidates").parent().appendto(jquery("form:first"));     }       function closeaddrcandidateswin() {         $("#<%=lstcandidates.clientid %>").val("");         $("#<%=lstcandidates.clientid %>").hide();         $("#divaddrcandidates").dialog("close");     } 

this code behind:

protected void save_click(object sender, system.eventargs e)  {          jsonaddresses = wsjson.getaddresscandidate(physicaladdrtoprocess);                 int count = jsonaddresses.candidates.length;                 (int = 0; < count; i++)                 {                     lstcandidates.items.add(jsonaddresses.candidates[i].address.tostring());                     }           string key = "_openaddrcandidateswin";         string script = "openaddrcandidateswin();";         if (!page.clientscript.isstartupscriptregistered(key))         {             page.clientscript.registerstartupscript(this.gettype(), key, script, true);         } } 

what did miss here? code went through without error dialog doesn't pop up, although set break @ jquery never stops there. appreciated.

it because executing method before dom loaded.

try changing string script = "openaddrcandidateswin();"; string script = "$(function () { openaddrcandidateswin(); })"; wait until dom loaded , execute method.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -