Create Columns at run time

Discussion in 'ASP .Net Datagrid Control' started by Tina, Oct 2, 2005.

  1. Tina

    Tina Guest

    if you place a datagrid on a form and then, in Property builder, check the
    box saying Create Columns at run time. An then do a SQL Select into a
    datatable, and then bind the datatable to the grid, the grid displays
    correctly. BUT, the columns array is empty. The grid displays just fine.
    There are cells and rows but no columns.

    I want to make some of the columns non visible but I can't because there are
    no columns.

    Why is this?
    Thanks,
    Tina
     
    Tina, Oct 2, 2005
    #1
    1. Advertising

  2. Tina

    Scott M. Guest

    If the columns are going to be made automatically at run-time, then you
    can't modify them at design-time.

    If you are going to want to configure aspects of the columns yourself, then
    you'll need to un-check "Create columns automatically at run time." and
    manually add columns yourself.

    I suggest adding Bound columns first and configuring each to be bound to the
    appropriate data field from your data source. After they are created and
    working, I would then click the link in the bottom of the Property Builder
    to "Convert to Template Column", so that you can get even more control over
    the configuration of the columns.



    "Tina" <> wrote in message
    news:...
    > if you place a datagrid on a form and then, in Property builder, check the
    > box saying Create Columns at run time. An then do a SQL Select into a
    > datatable, and then bind the datatable to the grid, the grid displays
    > correctly. BUT, the columns array is empty. The grid displays just fine.
    > There are cells and rows but no columns.
    >
    > I want to make some of the columns non visible but I can't because there
    > are no columns.
    >
    > Why is this?
    > Thanks,
    > Tina
    >
     
    Scott M., Oct 2, 2005
    #2
    1. Advertising

  3. Tina

    Tina Guest

    I Can't do what you say because my program is a SQLTable Update Utility. I
    don't know what the columns will be at design time.

    I'm "Creating the columns at run time" via a databind which does indeed
    create the grid correctly but the Columns array is nothing i.e.
    Datagrid1.columns(0) is out of bounds.

    It seems the columns array should be there. the Headertext is even there
    which is an attribute of the columns in the array.

    What is really odd is related to another thread you replied to where my
    datagrid was empty in a subsequent button click event. It was because I had
    the Create columns checkbox checked!!!!!!!! When I unchecked it, my grid
    had all of its rows and data in the button event. I think thats a bug in
    the grid componnet.
    T

    "Scott M." <> wrote in message
    news:...
    > If the columns are going to be made automatically at run-time, then you
    > can't modify them at design-time.
    >
    > If you are going to want to configure aspects of the columns yourself,
    > then you'll need to un-check "Create columns automatically at run time."
    > and manually add columns yourself.
    >
    > I suggest adding Bound columns first and configuring each to be bound to
    > the appropriate data field from your data source. After they are created
    > and working, I would then click the link in the bottom of the Property
    > Builder to "Convert to Template Column", so that you can get even more
    > control over the configuration of the columns.
    >
    >
    >
    > "Tina" <> wrote in message
    > news:...
    >> if you place a datagrid on a form and then, in Property builder, check
    >> the box saying Create Columns at run time. An then do a SQL Select into
    >> a datatable, and then bind the datatable to the grid, the grid displays
    >> correctly. BUT, the columns array is empty. The grid displays just
    >> fine. There are cells and rows but no columns.
    >>
    >> I want to make some of the columns non visible but I can't because there
    >> are no columns.
    >>
    >> Why is this?
    >> Thanks,
    >> Tina
    >>

    >
    >
     
    Tina, Oct 2, 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. lien
    Replies:
    0
    Views:
    359
  2. Tina

    Create Columns at run time

    Tina, Oct 2, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    340
  3. Gary Blakely

    DataGrid Columns Created at Run time

    Gary Blakely, Oct 7, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    371
    Gary Blakely
    Oct 7, 2005
  4. flamesrock
    Replies:
    8
    Views:
    548
    Hendrik van Rooyen
    Nov 24, 2006
  5. Pierre Yves
    Replies:
    2
    Views:
    522
    Pierre Yves
    Jan 10, 2008
Loading...

Share This Page