PC Review


Reply
Thread Tools Rate Thread

Datagrid Viewstate not working correctly?

 
 
Nomen Nescio
Guest
Posts: n/a
 
      7th Feb 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
 
      7th Feb 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
 
      7th Feb 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
Rate This Thread
Rate This Thread:

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
Url not working correctly in DataGrid tshad Microsoft ASP .NET 4 1st Aug 2007 12:52 AM
Does viewstate works correctly on VS 2005 web server? GS Microsoft ASP .NET 7 3rd Feb 2006 09:34 PM
Datagrid ViewState Alejandro Penate-Diaz Microsoft ASP .NET 2 2nd Mar 2005 04:22 PM
viewstate on datagrid Dave Bartlett Microsoft ASP .NET 1 9th Jul 2004 04:43 PM
Viewstate in DataGrid doesn't seem to be working Nir Erlich Microsoft Dot NET Framework 0 29th Sep 2003 05:19 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:42 AM.