Page fails to load when arraylist being saved in Viewstate
-
Hi, I'm facing problem when i load page with dynamically created controls. This happens if i save a arraylist in viewstate. ViewState["Delim"] = arrList; I searched the net, and found that we can save arraylists in viewstate, and that try saving it in page_preRender. I did so, but same issue. If i save some string in viewstate instead, it doesn't have any problems loading the dynamic controls. Anyone can help me here, to resolve this? Thanks, Deepa
-
Hi, I'm facing problem when i load page with dynamically created controls. This happens if i save a arraylist in viewstate. ViewState["Delim"] = arrList; I searched the net, and found that we can save arraylists in viewstate, and that try saving it in page_preRender. I did so, but same issue. If i save some string in viewstate instead, it doesn't have any problems loading the dynamic controls. Anyone can help me here, to resolve this? Thanks, Deepa
deep7 wrote:
I'm facing problem when i load page with dynamically created controls
Where did you create those control ? You should have to create dynamic control before page_load to holds the ViewState.
deep7 wrote:
and that try saving it in page_preRender.
I guess, Before
PreRender
, allviewstate
data are saved. :)Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
deep7 wrote:
I'm facing problem when i load page with dynamically created controls
Where did you create those control ? You should have to create dynamic control before page_load to holds the ViewState.
deep7 wrote:
and that try saving it in page_preRender.
I guess, Before
PreRender
, allviewstate
data are saved. :)Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
Hi, Dynamic controls are created in page load. Also, is it something to do with declaration of Arraylist? I declare it as global variable. I tried saving the arraylist object in page load after controls are generated. But still same problem. Please note, the arraylist contains objects of a particular class. Is it a problem? I dont get it...it goes to the Application_Error event in global.asax.cs. How do i resolve this? i need to store the arraylist in viewstate, because i require it on one button click event.
-
Hi, Dynamic controls are created in page load. Also, is it something to do with declaration of Arraylist? I declare it as global variable. I tried saving the arraylist object in page load after controls are generated. But still same problem. Please note, the arraylist contains objects of a particular class. Is it a problem? I dont get it...it goes to the Application_Error event in global.asax.cs. How do i resolve this? i need to store the arraylist in viewstate, because i require it on one button click event.
deep7 wrote:
Dynamic controls are created in page load.
As I already mention Dynamic Control Can be created on
Page_Load
, BUT If you create dynamic control onPage_Load()
or after, It will not able to load Postback data and View State Data. Because,LoadViewState
andLoadPostback
data called before thePage_Load(
) inASP.NET Page Life Cycle
.Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.