Dynamic DataField

Discussion in 'ASP .Net Datagrid Control' started by Msdn, Sep 1, 2006.

  1. Msdn

    Msdn Guest

    I have a Gridview which have 3 boundfields and 6 templatecols with
    imagebuttons.

    I would like to use this grid with different dataset and must therefore
    change the datafield of each boundfield based on the dataset, how do i do
    that at runtime ?

    Regards Keld
    Msdn, Sep 1, 2006
    #1
    1. Advertising

  2. Msdn

    Riki Guest

    Msdn wrote:
    > I have a Gridview which have 3 boundfields and 6 templatecols with
    > imagebuttons.
    >
    > I would like to use this grid with different dataset and must
    > therefore change the datafield of each boundfield based on the
    > dataset, how do i do that at runtime ?
    >
    > Regards Keld


    I think you can do it by setting AutoGenerateColumns=True
    (and removing the boundfields).
    The grid will generate a column for each field in the dataset.

    --

    Riki
    Riki, Sep 1, 2006
    #2
    1. Advertising

  3. Msdn

    Msdn Guest

    I cant autogenerate cols because my dataset contains other fields which i
    wont display in the grid.

    Regards Keld
    "Riki" <> skrev i en meddelelse
    news:...
    > Msdn wrote:
    >> I have a Gridview which have 3 boundfields and 6 templatecols with
    >> imagebuttons.
    >>
    >> I would like to use this grid with different dataset and must
    >> therefore change the datafield of each boundfield based on the
    >> dataset, how do i do that at runtime ?
    >>
    >> Regards Keld

    >
    > I think you can do it by setting AutoGenerateColumns=True
    > (and removing the boundfields).
    > The grid will generate a column for each field in the dataset.
    >
    > --
    >
    > Riki
    >
    Msdn, Sep 4, 2006
    #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. Adil Bohoudi
    Replies:
    1
    Views:
    452
    Eric Wise
    Aug 6, 2003
  2. richard

    get DataField value in UpdateCommand

    richard, Dec 2, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    399
    richard
    Dec 2, 2003
  3. Husht

    Get the datafield name??

    Husht, Aug 4, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    386
    Eliyahu Goldin
    Aug 4, 2004
  4. Husht

    Get the datafield name??

    Husht, Aug 4, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    414
    Husht
    Aug 4, 2004
  5. Dinçer

    How to get DataField value of a cell

    Dinçer, Dec 9, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    6,762
    Eliyahu Goldin
    Dec 9, 2004
Loading...

Share This Page