DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
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:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us