Reputation: 707
I'm trying to read the text of a .Net control. I show the control in a jquery modal popup. then I submit the form with a .Net button. When I try to read the control server side, there is nothing in its text property. How do I read the textbox control that has been populated within a jquery modal dialog? I will certainly try alternatives to what I am doing...using .Net and jquery.
page:
<img id="divTestQ" src="assets/images/edit_icon.gif" alt="Add Comments" />
<div style="display:none;">
<div id="divTest" title="Program Discipline" style="text-align: left;">
<asp:TextBox id="test" TextMode="MultiLine" Rows="30" style="width: 100%;"
runat="server" />
</div>
</div>
<asp:button id="btnSubmit" text="label" runat="server" />
jQuery:
$("#divTest").dialog({
autoOpen: false,
show: "blind",
width: 500,
height: 480,
modal: true
});
$("#divTestQ").click(function () {
$("#divTest").dialog("open");
return false;
});
Code Behind:
String textBox = test.Text; //Nothing
TextBox textBox = (TextBox)Page.FindControl("ctl00_ContentPlaceHolder1_test"); //Also Nothing
Upvotes: 0
Views: 497
Reputation: 82
The issue is that the textbox is now outside of the form. The way around this is to attach the modal to the form when opening it.
$(document).ready(function () {
$("#divTest").dialog({
autoOpen: false,
show: "blind",
width: 500,
height: 480,
modal: true,
open: function (type, data) {
$(this).parent().appendTo("form");
}
});
Upvotes: 1