Dear All
I am setting some text to server side label in javascript
but on postback i am losing its values
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.
Prabhu RajaPosted Sep 19, 2011, 6:53 AM
labels are just like text in html, there is no data sent back to server in postback. you may try with Hidden Field to Track the text of label.
Or Use Call-back rather then Post-Back
----------------------------------------------------------------------
Thank You
Mayur GujrathiPosted Sep 19, 2011, 6:42 AM
Yes i have
Suthish NairPosted Sep 19, 2011, 6:04 AM
Dorababu MekaPosted Sep 19, 2011, 5:43 AM
if not use session concept and implement the logic in page load some thing like
protected void Page_Load(object sender, EventArgs e)
{
if (Session["lbl"] != null)
{
label1.Text = Session["lbl"].ToString();
Session.Remove("lbl");
}
}
and in what ever event that you are writing which cause post back add this
Session.Add("lbl", label1.Text);