Solved

gridview1.Columns.Count

Posted on 2009-06-30
6
399 Views
Last Modified: 2013-12-17
I have a gridview in which the columns are automatically created. Here is my code

        GridView_FrequentAtt_Pivot.DataSource = DS;
        GridView_FrequentAtt_Pivot.DataBind();

I am trying to count the number of columns using

Response.Write(GridView_FrequentAtt_Pivot.Columns.Count);

but it always returns the number 1.

I am not sure what is going on here
0
Comment
Question by:Mr_Shaw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 53

Assisted Solution

by:Dhaest
Dhaest earned 100 total points
ID: 24743993
Do you have returned records ?

Count records
   if(dt.Rows.count > 0)
Count columns
   if(dt.Columns.Count > 0)
0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 24744151
check
DS.Table(0).Rows.count

0
 
LVL 39

Expert Comment

by:Pratima Pharande
ID: 24744157
check
DS.Tables(0).Rows.count
0
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 

Author Comment

by:Mr_Shaw
ID: 24744380
yes I have 62 rows
0
 
LVL 39

Accepted Solution

by:
Pratima Pharande earned 400 total points
ID: 24744592
Count the number

DS.Tables(0).Columns.Count
0
 

Author Closing Comment

by:Mr_Shaw
ID: 31598287
thanks
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
This video shows how to use Hyena, from SystemTools Software, to update 100 user accounts from an external text file. View in 1080p for best video quality.

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question