ASP.NET - how to avoid label value clear when page refresh
Asked By msakt on 16-Apr-12 01:29 AM
how to avoid label value clear when page refresh
Danasegarane Arunachalam replied to msakt on 16-Apr-12 01:34 AM
If the value is getting cleared on postback means that you are not binding the label in If not PostBack event
I Not Page.IsPostBack Then
' The Page is loading for the first time.
'Bind the Label Here
Reena Jain replied to msakt on 16-Apr-12 01:34 AM
By using Update panel you can prevent the part of the page from the PostBack so the portion of the webpage define inside the update panel won't get refreshed by the postback. so you can put your label in update panel to prevent
but at the time of reload the page the entire webpage (including update panel) will be refreshed
Somesh Yadav replied to msakt on 16-Apr-12 02:25 AM
For avoiding the page refresh, place all your controls inside update panel like the below
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:DropDownList ID="DropDownList2" runat="server">
Sri K replied to msakt on 16-Apr-12 02:36 AM
You need to set the value in the Page IsPostback property value.
"Welcome to World!"
Anoop S replied to msakt on 16-Apr-12 02:41 AM
Do you have label databind in Page_Load? If yes, put the logic in
dipa ahuja replied to msakt on 16-Apr-12 03:52 AM
protected void Page_Load(object sender, EventArgs e)