all groups > asp.net building controls > december 2003 >
You're in the

asp.net building controls

group:

Losing viewstate in custom control



Losing viewstate in custom control williamfrench1 NO[at]SPAM yahoo.com
12/4/2003 1:46:19 PM
asp.net building controls: I have a custom control I derived from the datagrid control and set a
couple of values in viewstate("foo") = "bar" but on postback they are
nothing. I have seen an example of doing this in the O'Reilly book
"Programming asp.net" pg 645. I must be missing something. Any help
Re: Losing viewstate in custom control William French
12/5/2003 1:50:54 PM
I was putting together a simple example to post when I figured out what
I did. I had moved the order of the control in the controls collection
by adding other child controls. I guess viewstate is assigned based on
that order.

I am having another interesting viestate issue know where I can add
somthing to viewstate on the first load of the control but on post back
I cannot update viewstate. Is that how it works. Also I noticed that
when an onclick event fires for another derived control I am using
viewstate isn't available at that point yet. Any ideas? Thanks for
your help.

*** Sent via Developersdex http://www.developersdex.com ***
Re: Losing viewstate in custom control Teemu Keiski
12/5/2003 9:00:34 PM
What's the code you are trying? Post some more.

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist


[quoted text, click to view]

AddThis Social Bookmark Button