Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > DataGrid Viewstate problem

Reply
Thread Tools

DataGrid Viewstate problem

 
 
Josema
Guest
Posts: n/a
 
      05-20-2004
Hi, to all..

I have 2 web controls (MyDataGrid.cs, MyCalendar.cs

The first inherits from calendar, and i have implemented the event MyCalendar_SelectionChanged and inside of this i put in the viewstate a datatable that i filled (and its filled, i verified)... like this

Viewstate.Add("DATA", MyDataTable)

The second inherits from DataGrid, and i override the On_Load in the control and inside this i have

this.DataSource=Viewstate["DATA"]
this.DataBind()

But doesnt ocurr nothing... Im doing well the use of the viewstate?..

Thanks very much.

Josema.
 
Reply With Quote
 
 
 
 
Teemu Keiski
Guest
Posts: n/a
 
      05-28-2004
Hi,

maybe it would be because SelectionChanged event is raised after Load event
(SelectionChanged is a postback event and occurs after Load events) e.g when
your dataGrid is to be data-bound there isn't anything in ViewState yet. Do
you check for isPostBack when binding DataGrid?

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
http://blogs.aspadvice.com/joteke

"Josema" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi, to all...
>
> I have 2 web controls (MyDataGrid.cs, MyCalendar.cs)
>
>
> The first inherits from calendar, and i have implemented the event

MyCalendar_SelectionChanged and inside of this i put in the viewstate a
datatable that i filled (and its filled, i verified)... like this:
>
> Viewstate.Add("DATA", MyDataTable);
>
> The second inherits from DataGrid, and i override the On_Load in the

control and inside this i have:
>
> this.DataSource=Viewstate["DATA"];
> this.DataBind();
>
> But doesnt ocurr nothing... Im doing well the use of the viewstate?...
>
> Thanks very much..
>
> Josema.



 
Reply With Quote
 
 
 
 
Natty Gur
Guest
Posts: n/a
 
      05-28-2004
Hi,

I don't think that you using ViewState correctly. Control should
implement IStateManager to support ViewState and it suppose to maintain
control own state (not other control state).

I don't know what exactly you after but probably calendar control should
implement property that other controls can call to obtain data. I don't
like this solution either, because any control should maintain its own
data and not others.


Natty Gur[MVP]

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
 
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