Note that there are some explanatory texts on larger screens.

plurals
  1. POSimulate a another button postback inside a jQuery dialog
    primarykey
    data
    text
    <p>I have the following ASPX page:</p> <pre><code>&lt;html xmlns="http://www.w3.org/1999/xhtml" &gt; &lt;head runat="server"&gt; &lt;title&gt;&lt;/title&gt; &lt;script src="js/jquery-1.2.6.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="js/jquery-ui-1.6.custom.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(function() { $("#dialog").dialog({ bgiframe: true, autoOpen: false, height: 300, modal: true, buttons: { 'Ok': function() { $(this).dialog('close'); __doPostBack('TreeNew', ''); }, Cancel: function() { $(this).dialog('close'); } }, close: function() { ; } }); }); function ShowDialog() { $('#dialog').dialog('open'); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:Button ID="TreeNew" runat="server" Text="Nuevo" OnClientClick="ShowDialog(); return false;"/&gt; &lt;asp:Label ID="Message" runat="server"&gt;&lt;/asp:Label&gt; &lt;div id="dialog" title="Create new user"&gt; &lt;p id="validateTips"&gt;All form fields are required.&lt;/p&gt; &lt;asp:RadioButtonList ID="ContentTypeList" runat="server"&gt; &lt;asp:ListItem Value="1"&gt;Text&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="2"&gt;Image&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="3"&gt;Audio&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="4"&gt;Video&lt;/asp:ListItem&gt; &lt;/asp:RadioButtonList&gt; &lt;/div&gt; &lt;/div&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>When the user click on TreeNew button appears the modal dialog, then he/she choose an option an click Ok button to do a postback.</p> <p>I need that the server side execute TreeNew_Click method: How can I do that?</p> <p>If I use __doPostBack('TreeNew', '') it throws me the following error: "Object expected".</p> <p><strong>UPDATE:</strong><br /> I found the origin for the error: the function <strong>__doPostBack</strong> is not defined. I'm not going to delete the question because I think Chris Clark's answer is so interesting.</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.
    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