How to submit to the server with JQuery.UI Dialog and ASP.Net?
- by Paul
Hi,
I'm looking for a way to submit information captured in a JQuery Dialog to the server in ASP.Net. I originally thought it would work with a 'hidden' asp button, but the click doesn't seem to be submitting the form. Here's the code I have so far:
<script type="text/javascript">
jQuery(document).ready(function() {
var dlg = jQuery("#dialog").dialog({
bgiframe: true,
autoOpen: false,
height: 150,
width: 300,
modal: true,
buttons: {
"Add": function() {
var btn = document.getElementById("<%=btnAdd.ClientID %>");
if (btn) btn.click();
$(this).dialog("close");
}
}
});
$("#dialog").parent().appendTo("#dialog_target");
});
</script>
<div id="hidden" style="visibility:hidden" >
<!-- Hidden button that actually triggers server add -->
<asp:Button ID="btnAdd"
runat="server"
style="display:none"
OnClick="btnAdd_Click" />
<!-- Hidden Delete Dialog -->
<div id="dialog" title="New Additional Skill">
<label>Additional Skill Name:</label>
<asp:TextBox ID="_txtNewSkillName" runat="server" />
</div>
Any pointers?