Question

I am using an ASP TextBox and a Telerik RadTextBox in my asp.net webform. I know the The both the controls clear its value after each postback and this is by design due to security reasons.

In my scenario both the controls are ajaxified. Still the ASP TextBox and RadTextBox loses it value on ajax request (partial postback).

So my doubt, is this expected? Will the textbox lose value on both full postback as well as on ajax request?

Was it helpful?

Solution

Both ASP.NET Textbox and Telerik Textbox will be rendered as <input type="password" />. <input type="password" /> is treated a little bit different than the other controls as it contains sensitive information. On every postback they are forcefully cleared.

But if there is some requirement then you can store the information and set it back.

string Password = txtPassword.Text;
txtPassword.Attributes.Add("value", Password);

Note: But I really don't recommend it.

OTHER TIPS

Ajax based function calling never causes Data loss or refresh happened in client side. I think it may be happened due to object you have selected for ajax calling. For eg:

<input type="button" id="Submit">
<input type="submit" id="Submit">

They exhibit different behavior in ajax calling.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top