Click here to Skip to main content
15,910,980 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hello !

This is kranti kumar.

I am working as web developer. My problem is I created one text box and set read only property as true, but after post back the value disappears.
How can I manage the value of the text box after the page post back.

plz any give reply its urgent.

Thank you.
Posted
Updated 31-Oct-11 23:04pm
v2
Comments
member60 1-Nov-11 5:25am    
what do u mean by value? textbox property or Text ?

Hi,

You can use this:

C#
if (!IsPostBack)
  {

  }


You can write the code inside this. It does not affect on postbacks.
 
Share this answer
 
<asp:textbox id="TextBox1" runat="server" readonly="true" xmlns:asp="#unknown">
C#
protected void Page_Load(object sender, EventArgs e)
{
    if (!IsPostBack)
    {
        TextBox1.Text = "set Text on Page load Test";
    }

}
 
Share this answer
 
Set EnableViewState property of textbox to true

This one is bydefault true check whether you have made it false anywhere
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900