|
|
|
start date: Wed, 25 Jul 2007 05:44:14 -0700,
posted on: microsoft.public.dotnet.framework.aspnet.webcontrols
back
| Thread Index |
|
1
Doogie
|
|
2
Phil H
|
GridView, accessing data
Hi
I have a gridview on my web page and I bind it to an object of my own
creation. When I click a button on that page, I want to get the data
from that gridview and cast it back into that object I created and
start to do work on it. I tried something like this:
List<MyObject> myObject = (List<MyObject>)myGrid.DataSource;
But I noticed that when I get to this line, "myGrid.DataSource" is
null. Yet, I can access the "myGrid.Rows.Count" value and see the
correct number of rows in my grid.
How can I convert to my own object?
Date:Wed, 25 Jul 2007 05:44:14 -0700
Author:
|
Re: GridView, accessing data
On 25 Jul, 13:44, Doogie wrote:
> Hi
> I have a gridview on my web page and I bind it to an object of my own
> creation. When I click a button on that page, I want to get the data
> from that gridview and cast it back into that object I created and
> start to do work on it. I tried something like this:
>
> List<MyObject> myObject = (List<MyObject>)myGrid.DataSource;
>
> But I noticed that when I get to this line, "myGrid.DataSource" is
> null. Yet, I can access the "myGrid.Rows.Count" value and see the
> correct number of rows in my grid.
>
> How can I convert to my own object?
Hi Doogie
Are you sure that the Gridview is bound by the DataSource property and
not DatasourceID? They are not the same. The former requires an
explicit execution of the Databind method to load the data the latter
does not.
Date:Tue, 31 Jul 2007 11:57:26 -0700
Author:
|
|
|