Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Datagrid Viewstate not working correctly?

Reply
Thread Tools

Datagrid Viewstate not working correctly?

 
 
Nomen Nescio
Guest
Posts: n/a
 
      02-07-2007

Hi,

I have a Datagrid with template columns (TextBox and Radiolist in them).
When I type something in the textbox and push a radiobutton and
subsequently push another button (not part of the datagrid) the contents
isn't restored on the round-trip, even though the Viewstate for the
Datagrid and the controls is set to 'true'.

Anyone have a clue what the problem could be? Someone told me there are
'problems' with the Viewstate in the Datagrid but from what I gather from
the documentation it should just work.

Thanks in advance


 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=
Guest
Posts: n/a
 
      02-07-2007
Morning,

It's desired behaviour. If you want reset controls to their initial state
rebind the data.

--
Milosz


"Nomen Nescio" wrote:

>
> Hi,
>
> I have a Datagrid with template columns (TextBox and Radiolist in them).
> When I type something in the textbox and push a radiobutton and
> subsequently push another button (not part of the datagrid) the contents
> isn't restored on the round-trip, even though the Viewstate for the
> Datagrid and the controls is set to 'true'.
>
> Anyone have a clue what the problem could be? Someone told me there are
> 'problems' with the Viewstate in the Datagrid but from what I gather from
> the documentation it should just work.
>
> Thanks in advance
>
>
>

 
Reply With Quote
 
 
 
 
Non scrivetemi
Guest
Posts: n/a
 
      02-07-2007

Sorry, I found the problem here:

http://msdn2.microsoft.com/en-us/library/aa478966.aspx

"Forgetting to Check for IsPostBack in the Page_Load Event"

I overlooked this since I'm using a base class written by someone else.
The problem was that it rebinded on every page load, resetting the old values.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems with ViewState: "function 'ViewState.get_Item' evaluated and returned null" Steph ASP .Net 2 05-11-2011 02:35 PM
Errors: Failed to load viewstate. & Validation of viewstate MAC failed. sck10 ASP .Net 6 09-01-2006 05:59 PM
Loading usercontrols, viewstate problem, slighly different from all others "viewstate uc problems" please help... ujjc001 ASP .Net 0 07-27-2005 01:52 PM
Viewstate errors... how do I get viewstate working? mark ASP .Net Building Controls 0 02-20-2004 02:17 PM
Corrupted ViewState (Yes, another issue concerning viewstate) Ben Rush ASP .Net 2 12-05-2003 04:17 PM



Advertisments