DataGrid.Column.Count is empty?

Discussion in 'ASP .Net Building Controls' started by SK, Feb 17, 2005.

  1. SK

    SK Guest

    Hello,

    I have created my own datagrid control, derived from
    datagrid. Now my webform uses this datagrrd and calls the
    ItemDataBound method, which then SHOULD loop through the
    columns, but it always shows me that the columns count is
    0. Although I can see several columns in the webbrowser.
    Now, I would like to know why it always shows 0?

    Any help is very appreciated.
    SK, Feb 17, 2005
    #1
    1. Advertising

  2. Mostly because you're still in the process of binding. The column count
    isn't really finalized until databinding has been finished. Try testing the
    column count of the grid after calling the databind() method.

    Hope this helps,
    Mark Fitzpatrick
    Microsoft MVP - FrontPage

    "SK" <> wrote in message
    news:1aab01c51539$ceda7670$...
    > Hello,
    >
    > I have created my own datagrid control, derived from
    > datagrid. Now my webform uses this datagrrd and calls the
    > ItemDataBound method, which then SHOULD loop through the
    > columns, but it always shows me that the columns count is
    > 0. Although I can see several columns in the webbrowser.
    > Now, I would like to know why it always shows 0?
    >
    > Any help is very appreciated.
    Mark Fitzpatrick, Feb 20, 2005
    #2
    1. Advertising

  3. SK

    MattC Guest

    Are you using autogenerated columns, if there will be no entry in the
    columns collection of the datagrid.

    MattC


    "SK" <> wrote in message
    news:1aab01c51539$ceda7670$...
    > Hello,
    >
    > I have created my own datagrid control, derived from
    > datagrid. Now my webform uses this datagrrd and calls the
    > ItemDataBound method, which then SHOULD loop through the
    > columns, but it always shows me that the columns count is
    > 0. Although I can see several columns in the webbrowser.
    > Now, I would like to know why it always shows 0?
    >
    > Any help is very appreciated.
    MattC, Feb 23, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UmV6YQ==?=
    Replies:
    3
    Views:
    5,500
    Craig Deelsnyder
    Mar 2, 2004
  2. Finn Stampe Mikkelsen

    Column count / Access GridView Column after DataBind

    Finn Stampe Mikkelsen, Aug 19, 2010, in forum: ASP .Net
    Replies:
    4
    Views:
    3,173
    Finn Stampe Mikkelsen
    Aug 20, 2010
  3. efelnavarro09
    Replies:
    2
    Views:
    917
    efelnavarro09
    Jan 26, 2011
  4. Kris Rudin

    Datagrid column count = 0??

    Kris Rudin, Nov 10, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    1
    Views:
    149
  5. Christopher Calhoun

    Datagrid Column Count HELP

    Christopher Calhoun, Jan 29, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    97
    Christopher Calhoun
    Jan 29, 2004
Loading...

Share This Page