Solved

gridview1.Columns.Count

Posted on 2009-06-30
6
389 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
  • 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
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 

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

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now