Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7692829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T20:56:35+00:00 2026-05-31T20:56:35+00:00

Friends, I’m populating a GridView in my asp.net application using following code. GridView grdExport

  • 0

Friends, I’m populating a GridView in my asp.net application using following code.

    GridView grdExport = new GridView();
    DataSet dsRecord = objHelper.gReturnDataSet(CommandType.Text, strSql);

    grdExport.DataSource = dsRecord.Tables[0];
    grdExport.DataBind();

Now the problem is in immediate window, when I’m checking, I’m getting following result:

    ?dsRecord.Tables[0].Columns.Count
    16
    ?dsRecord.Tables[0].Rows.Count
    37
    ?grdExport.Rows.Count
    37
    ?grdExport.Columns.Count
    0

Please, can anyone tell me why Column count is 0 for grdExport?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T20:56:37+00:00Added an answer on May 31, 2026 at 8:56 pm

    GridView.Columns Property

    Check this:

    The Columns property (collection) is used to store all the explicitly
    declared column fields that get rendered in the GridView control. You
    can also use the Columns collection to programmatically manage the
    collection of column fields.

    If you have more columns to your added columns in your grid then it will show count of those columns which you have added not the auto generated columns.

    If you show auto generated columns then it will show 0.
    Check this markup:

     <asp:GridView ID="GridView1" runat="server">
                <Columns>
                    <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID" />
                </Columns>
            </asp:GridView>
    

    Now it will Show your result of columns’s count to 1:
    //Before adding column to gridview

    ?dtResult.Rows.Count
    9
    ?dtResult.Columns.Count
    2
    ?GridView1.Rows.Count
    9
    ?GridView1.Columns.Count
    0
    

    After Adding column to gridview.

    ?GridView1.Columns.Count
    1
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

friends, i have created custom title bar using following titlebar.xml file with code <?xml
friends, i am using following code to display bitmap on screen and having next
friends, i am using asp.net calendar control on page. dynamically i am assigning it
friends, i am using asp.net 2.0 my requirement is when form is loaded it
friends, i am using following onDraw method to display bitmap on screen. @Override public
Friends, I am developing third party application on Spotify. I am using Spotify Client
Friends i am making an application in which i am using Map Activity. Now
Friends i have made a location based application. i have implemented all the code
Friends, I've a gridview in my web-page designed in the following manner:- <div id=divProducts
friends, i am opening google map application by using intents and URL to google

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.