To preserve value and not to re-populate ListBox or DropDownList in asp.net use following
if (!IsPostBack) //fill the listsTextBox "readonly" and viewstate
{
//for network dropdown
query = "select network from network";
reader = da.readData(query);
while (reader.Read())
{
Network.Items.Add(reader["network"].ToString());
}
}
(ref http://aspadvice.com/blogs/joteke/archive/2006/04/12/16409.aspx)
To retain data in a TextBox (datetime picker) in PostBack action use server side code
TextBox1.Attribute.Add ("readonly", "readonly");
rather than the client side
I had trouble figuring out this but this may help some other.
No comments:
Post a Comment