Click here to Skip to main content
15,881,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

everybody

I have a Label, Id is lbl
C#
lbl.Text="xxx";


and

I have a GridView ,

C#
Gv.datasource=ds;
gv.databind();
.....


now, my question is, i want to store the label information in viewstate["x"],and GridView inforamtion is also store in same viewstate["x"].

similarlly i'm adding 'n' no.of controls to store all the data in same Viewstate.

How to do this can anyone can help me plz
Posted

1 solution

Use the Dictionary inside the viewstate and then add your data as value and controlname as key in dictonary.
To retrive the values from viewstate cast into Dictionary and then use it.
 
Share this answer
 
Comments
Prabhakaran Soundarapandian 20-Aug-12 3:02am    
Find as useful..rate it
[no name] 20-Aug-12 3:04am    
could u plz explain with ex,

This is first time i'm using ViewState

Thank u
Prabhakaran Soundarapandian 20-Aug-12 3:07am    
Have a look on this link...useful for freshers http://www.codeproject.com/Articles/31344/Beginner-s-Guide-To-View-State

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