We are trying to make a register form inside a jQuery dialog, but the button which is supposed to transfer the information from the textboxes doesn’t send the information – meaning the c# function that I have made, receives blank data. The code that we have is:
This is the button that submits the information(our submit button is outside the jQuery dialog div and it is hidden; we use another js generated button as a shortcut):
<asp:Button ID="btntwo" runat="server" style="display:none" Text="" OnClick="registerSubmit_Click" />
This is the code that creates our jQuery dialog (we have javascript function that simulates a click of our asp button):
$('#Register').dialog(dialogOpts);
$.fx.speeds._default = 500;
$(function () {
$("#Register").dialog({
autoOpen: false,
buttons: {
Ok: function () {
$("[id*=btntwo]").click();
$('form').append('#Register');
}
},
show: "blind",
hide: "explode"
});
This is the code that we use for our input fields, which are located in our jQuery dialog:
<asp:TextBox ID="username_textbox" runat="server" />
This is our c# function, which takes the data from the input fields and uses this data after that.
string username = username_textbox.Text;
Here is our problem: the expected result is that the username variable will be whatever is inputted by the user, but instead this variable receives only blank data “”.
Here is the solution for your problem:
jQuery dialog form submission not POSTing values