Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Get number of columns of a late bound GridView

Reply
Thread Tools

Get number of columns of a late bound GridView

 
 
ctilly@gmail.com
Guest
Posts: n/a
 
      06-27-2006
If I have a GridView that I don't bind until run time like so...

GridView1.DataSource = someTable;
GridView1.DataBind();

Is it possible for me to use the Count property? When I attempt
something like this..

GridView1.Columns.Count I always get a 0. I can't figure it out.

Any thoughts?

Regards.

 
Reply With Quote
 
 
 
 
Vadivel Kumar
Guest
Posts: n/a
 
      06-27-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> If I have a GridView that I don't bind until run time like so...
>
> GridView1.DataSource = someTable;
> GridView1.DataBind();
>
> Is it possible for me to use the Count property? When I attempt
> something like this..
>
> GridView1.Columns.Count I always get a 0. I can't figure it out.
>
> Any thoughts?
>
> Regards.
>


Its only matters that in which event you're binding the data and calling
the Count property.

GridView control will assign the data source once after the RowDataBound
event.

Check for this and call the Count property in appropriate place.

If you're problem is not solved, please post some of your code here.

-
Vadivel Kumar
http://vadivelk.net
 
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
Columns not bound to DetailsView get set to NULL on update Nick Bennett ASP General 1 01-20-2008 02:17 PM
Late bound sort of gridview Haim Katz ASP .Net Web Controls 0 08-11-2007 02:48 PM
template columns and bound columns in gridview Vinki ASP .Net Web Controls 2 04-25-2007 04:22 PM
How to relate bound GridView columns to an unbound checkbox in the same row? keithb ASP .Net 1 04-08-2006 05:31 PM
can't get data to show with bound columns headware ASP .Net Datagrid Control 4 07-10-2003 04:09 PM



Advertisments