Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi...
I want to stroe data in div element.it get lost after page refresh....how can i achieve it...
Posted
Comments
Ankur\m/ 20-Sep-12 9:30am    
Where does this data come from - user enters it? do you have form fields to do that?
Please know that we have no idea about what you are doing and we won't really be able to answer your question unless you explain it properly.
Resam11 20-Sep-12 9:32am    
Yes user enter data...
Ankur\m/ 20-Sep-12 10:42am    
Where?
Vani Kulkarni 20-Sep-12 9:40am    
Your question is unclear and vague. Please elaborate and let us know your specific issue.
Raje_ 20-Sep-12 9:41am    
And why are you storing data in div element? you can use Application, ViewState, Or Session object.

1 solution

Hi,

Use hidden field because data stored in hidden field does not get lost when page is get post back.
Before getting page post back store yr value in hidden field
VB
<asp:HiddenField ID="HiddenField1" runat="server" />

C#
HiddenField1.Value = "Yr Value in Div";

For reading from it just
C#
divId.InnerHtml= HiddenField1.Value;

Hope this will work.
 
Share this answer
 
v2

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