I am loading text into a textbox through jquery as so:
$.ajax({
type: "POST",
url: "../myfile.ascx/myfunction",
data: "{variable:'" + value + "'}",
contentType: "application/json",
dataType: "json",
success: function (response) {
$('input[id$=txtMyTextBox]').val(response.d);
}
});
this portion works fine, but when I cause the page to postback from other controls I loose the value it had inserted in txtMyTextBox..Now I am using a user control so I have a databind instead of page load. I tried this:
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "RefreshJob();", true);
}
but that wouldn't bring back the value either. I added a hidden field which holds the value after any postback, but not sure what to do to keep the value in the textbox aswell.