hello ,
if i want to retain my value of a textbox on refresh of a page or on previous page. how can i do it.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
selva kumarPosted Jun 12, 2013, 7:42 AM
http://www.codeproject.com/KB/custom-controls/ASPNET_Password_TextBox.aspx
use above link it will be helful......
Jignesh TrivediPosted Jun 12, 2013, 7:08 AM
hi,
It is depending on Situation.
you have also Page.PreviousPage property. with the help of this you can find value of previous page.
for example.....
TextBox tb = (TextBox)PreviousPage.FindControl("Text1");
Please refer
http://msdn.microsoft.com/en-us/library/system.web.ui.page.previouspage.aspx
http://msdn.microsoft.com/en-us/library/6c3yckfw(v=vs.85).aspx
hope this will help you.
Sanjeeb LenkaPosted Jun 12, 2013, 6:58 AM
ex-
consider a button click event
protected void Button1_Click(object sender, EventArgs e)
{
TextBox1.Text=Session["name"].ToString();
}
and if you call the clear text box method in page load put it within
if (!Page.IsPostBack)
{
TextBox1.Text=string.Empty;
}
so on every poatback it will not get cleared.
if not solved, provide your source code
ashima kukrejaPosted Jun 12, 2013, 6:45 AM
Sanjeeb LenkaPosted Jun 12, 2013, 2:53 AM