Dear All
I am setting some text to server side label in javascript
but on postback i am losing its values
Loosing text in label on postback
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Dorababu MekaRank #457 · 5.5K reputationPosted Sep 19, 2011, 1:43 AM EDT
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);
Suthish NairRank #92 · 22.8K reputationPosted Sep 19, 2011, 2:04 AM EDT
Mayur GujrathiRank #666 · 3.6K reputationPosted Sep 19, 2011, 2:42 AM EDT
Yes i have
Prabhu RajaRank #861 · 2.6K reputationPosted Sep 19, 2011, 2:53 AM EDT
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