DropDownList show the name of columns of dataGrid

Discussion in 'ASP .Net Datagrid Control' started by dalbo, Aug 24, 2005.

  1. dalbo

    dalbo Guest

    Hello, I make a dataGrid and i like to show the name of the columns of the
    dataGrid in a DropDownList. For example, if my dataGrid have three columns
    called "NAME" "ADDRESS" "CITY" i like show "NAME" "ADDRESS" "CITY" in the
    DropDownList.

    Thanks David, and sorry for my poor english.
    dalbo, Aug 24, 2005
    #1
    1. Advertising

  2. dalbo

    dalbo Guest

    Yes, I know and in my DataGrid i see the name of the columns. But my problem
    is i need to make a new DropDownList with the name of the columns.

    "Eliyahu Goldin" escribió:

    > You can find the names of the columns in the datagrid Columns property
    > unless the grid is AutoGenerated.
    >
    > Eliyahu
    >
    > "dalbo" <> wrote in message
    > news:...
    > > Hello, I make a dataGrid and i like to show the name of the columns of the
    > > dataGrid in a DropDownList. For example, if my dataGrid have three columns
    > > called "NAME" "ADDRESS" "CITY" i like show "NAME" "ADDRESS" "CITY" in the
    > > DropDownList.
    > >
    > > Thanks David, and sorry for my poor english.

    >
    >
    >
    dalbo, Aug 24, 2005
    #2
    1. Advertising

  3. You can find the names of the columns in the datagrid Columns property
    unless the grid is AutoGenerated.

    Eliyahu

    "dalbo" <> wrote in message
    news:...
    > Hello, I make a dataGrid and i like to show the name of the columns of the
    > dataGrid in a DropDownList. For example, if my dataGrid have three columns
    > called "NAME" "ADDRESS" "CITY" i like show "NAME" "ADDRESS" "CITY" in the
    > DropDownList.
    >
    > Thanks David, and sorry for my poor english.
    Eliyahu Goldin, Aug 24, 2005
    #3
  4. dalbo

    dalbo Guest

    The problem is i have a dataGrid with three columns called NAME ADDRESS CITY.
    If i create a DropDownList and i use
    DropDownList1.DataTextField = "NOMBRE"; in my DropDownList i see the list of
    names but i like to do something that this
    DropDownList1.DataTextField = "?????????"; to see in the DropDownList
    NAME,ADDRESS,CITY ,it is to say, the name of the columns.

    Thanks for the help and sorry for my poor english again.

    David.

    Example of table

    NAME | ADDRESS | CITY
    | |
    David | Micasa | habichuelas
    Otro | distinto | mas

    "Eliyahu Goldin" escribió:

    > Can you elaborate what exactly the problem is? Creating a ddl? Populating it
    > with column names? What did you try that didn't work for you?
    >
    > Eliyahu
    >
    > "dalbo" <> wrote in message
    > news:...
    > > Yes, I know and in my DataGrid i see the name of the columns. But my

    > problem
    > > is i need to make a new DropDownList with the name of the columns.
    > >
    > > "Eliyahu Goldin" escribió:
    > >
    > > > You can find the names of the columns in the datagrid Columns property
    > > > unless the grid is AutoGenerated.
    > > >
    > > > Eliyahu
    > > >
    > > > "dalbo" <> wrote in message
    > > > news:...
    > > > > Hello, I make a dataGrid and i like to show the name of the columns of

    > the
    > > > > dataGrid in a DropDownList. For example, if my dataGrid have three

    > columns
    > > > > called "NAME" "ADDRESS" "CITY" i like show "NAME" "ADDRESS" "CITY" in

    > the
    > > > > DropDownList.
    > > > >
    > > > > Thanks David, and sorry for my poor english.
    > > >
    > > >
    > > >

    >
    >
    >
    dalbo, Aug 24, 2005
    #4
  5. Can you elaborate what exactly the problem is? Creating a ddl? Populating it
    with column names? What did you try that didn't work for you?

    Eliyahu

    "dalbo" <> wrote in message
    news:...
    > Yes, I know and in my DataGrid i see the name of the columns. But my

    problem
    > is i need to make a new DropDownList with the name of the columns.
    >
    > "Eliyahu Goldin" escribió:
    >
    > > You can find the names of the columns in the datagrid Columns property
    > > unless the grid is AutoGenerated.
    > >
    > > Eliyahu
    > >
    > > "dalbo" <> wrote in message
    > > news:...
    > > > Hello, I make a dataGrid and i like to show the name of the columns of

    the
    > > > dataGrid in a DropDownList. For example, if my dataGrid have three

    columns
    > > > called "NAME" "ADDRESS" "CITY" i like show "NAME" "ADDRESS" "CITY" in

    the
    > > > DropDownList.
    > > >
    > > > Thanks David, and sorry for my poor english.

    > >
    > >
    > >
    Eliyahu Goldin, Aug 24, 2005
    #5
  6. dalbo

    dalbo Guest

    This is the problem, there can be a different set of columns because the
    table of the DataGrid it is going to change very frequently. And i don't know
    how many columns have the new table.

    David

    "Eliyahu Goldin" escribió:

    > David,
    >
    > Will the dropdownlist always contain items NAME,ADDRESS,CITY? Or there can
    > be a different set of columns depending on the table bound to the datagrid?
    >
    > Eliyahu
    >
    > "dalbo" <> wrote in message
    > news:...
    > > The problem is i have a dataGrid with three columns called NAME ADDRESS

    > CITY.
    > > If i create a DropDownList and i use
    > > DropDownList1.DataTextField = "NOMBRE"; in my DropDownList i see the list

    > of
    > > names but i like to do something that this
    > > DropDownList1.DataTextField = "?????????"; to see in the DropDownList
    > > NAME,ADDRESS,CITY ,it is to say, the name of the columns.
    > >
    > > Thanks for the help and sorry for my poor english again.
    > >
    > > David.
    > >
    > > Example of table
    > >
    > > NAME | ADDRESS | CITY
    > > | |
    > > David | Micasa | habichuelas
    > > Otro | distinto | mas
    > >
    > > "Eliyahu Goldin" escribió:
    > >
    > > > Can you elaborate what exactly the problem is? Creating a ddl?

    > Populating it
    > > > with column names? What did you try that didn't work for you?
    > > >
    > > > Eliyahu
    > > >
    > > > "dalbo" <> wrote in message
    > > > news:...
    > > > > Yes, I know and in my DataGrid i see the name of the columns. But my
    > > > problem
    > > > > is i need to make a new DropDownList with the name of the columns.
    > > > >
    > > > > "Eliyahu Goldin" escribió:
    > > > >
    > > > > > You can find the names of the columns in the datagrid Columns

    > property
    > > > > > unless the grid is AutoGenerated.
    > > > > >
    > > > > > Eliyahu
    > > > > >
    > > > > > "dalbo" <> wrote in message
    > > > > > news:...
    > > > > > > Hello, I make a dataGrid and i like to show the name of the

    > columns of
    > > > the
    > > > > > > dataGrid in a DropDownList. For example, if my dataGrid have three
    > > > columns
    > > > > > > called "NAME" "ADDRESS" "CITY" i like show "NAME" "ADDRESS" "CITY"

    > in
    > > > the
    > > > > > > DropDownList.
    > > > > > >
    > > > > > > Thanks David, and sorry for my poor english.
    > > > > >
    > > > > >
    > > > > >
    > > >
    > > >
    > > >

    >
    >
    >
    dalbo, Aug 24, 2005
    #6
  7. David,

    Will the dropdownlist always contain items NAME,ADDRESS,CITY? Or there can
    be a different set of columns depending on the table bound to the datagrid?

    Eliyahu

    "dalbo" <> wrote in message
    news:...
    > The problem is i have a dataGrid with three columns called NAME ADDRESS

    CITY.
    > If i create a DropDownList and i use
    > DropDownList1.DataTextField = "NOMBRE"; in my DropDownList i see the list

    of
    > names but i like to do something that this
    > DropDownList1.DataTextField = "?????????"; to see in the DropDownList
    > NAME,ADDRESS,CITY ,it is to say, the name of the columns.
    >
    > Thanks for the help and sorry for my poor english again.
    >
    > David.
    >
    > Example of table
    >
    > NAME | ADDRESS | CITY
    > | |
    > David | Micasa | habichuelas
    > Otro | distinto | mas
    >
    > "Eliyahu Goldin" escribió:
    >
    > > Can you elaborate what exactly the problem is? Creating a ddl?

    Populating it
    > > with column names? What did you try that didn't work for you?
    > >
    > > Eliyahu
    > >
    > > "dalbo" <> wrote in message
    > > news:...
    > > > Yes, I know and in my DataGrid i see the name of the columns. But my

    > > problem
    > > > is i need to make a new DropDownList with the name of the columns.
    > > >
    > > > "Eliyahu Goldin" escribió:
    > > >
    > > > > You can find the names of the columns in the datagrid Columns

    property
    > > > > unless the grid is AutoGenerated.
    > > > >
    > > > > Eliyahu
    > > > >
    > > > > "dalbo" <> wrote in message
    > > > > news:...
    > > > > > Hello, I make a dataGrid and i like to show the name of the

    columns of
    > > the
    > > > > > dataGrid in a DropDownList. For example, if my dataGrid have three

    > > columns
    > > > > > called "NAME" "ADDRESS" "CITY" i like show "NAME" "ADDRESS" "CITY"

    in
    > > the
    > > > > > DropDownList.
    > > > > >
    > > > > > Thanks David, and sorry for my poor english.
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >
    Eliyahu Goldin, Aug 24, 2005
    #7
  8. You need to databind the ddl to the datagrid Column collection. Try

    <asp:DropDownList ... DataSource = <%# myGrid.Columns %>
    DataTextField="HeaderText">

    Alternatively you can do it in the code. Note again, that this will work
    only for non-AutoGenerated columns.

    Eliyahu

    "dalbo" <> wrote in message
    news:...
    > This is the problem, there can be a different set of columns because the
    > table of the DataGrid it is going to change very frequently. And i don't

    know
    > how many columns have the new table.
    >
    > David
    >
    > "Eliyahu Goldin" escribió:
    >
    > > David,
    > >
    > > Will the dropdownlist always contain items NAME,ADDRESS,CITY? Or there

    can
    > > be a different set of columns depending on the table bound to the

    datagrid?
    > >
    > > Eliyahu
    > >
    > > "dalbo" <> wrote in message
    > > news:...
    > > > The problem is i have a dataGrid with three columns called NAME

    ADDRESS
    > > CITY.
    > > > If i create a DropDownList and i use
    > > > DropDownList1.DataTextField = "NOMBRE"; in my DropDownList i see the

    list
    > > of
    > > > names but i like to do something that this
    > > > DropDownList1.DataTextField = "?????????"; to see in the DropDownList
    > > > NAME,ADDRESS,CITY ,it is to say, the name of the columns.
    > > >
    > > > Thanks for the help and sorry for my poor english again.
    > > >
    > > > David.
    > > >
    > > > Example of table
    > > >
    > > > NAME | ADDRESS | CITY
    > > > | |
    > > > David | Micasa | habichuelas
    > > > Otro | distinto | mas
    > > >
    > > > "Eliyahu Goldin" escribió:
    > > >
    > > > > Can you elaborate what exactly the problem is? Creating a ddl?

    > > Populating it
    > > > > with column names? What did you try that didn't work for you?
    > > > >
    > > > > Eliyahu
    > > > >
    > > > > "dalbo" <> wrote in message
    > > > > news:...
    > > > > > Yes, I know and in my DataGrid i see the name of the columns. But

    my
    > > > > problem
    > > > > > is i need to make a new DropDownList with the name of the columns.
    > > > > >
    > > > > > "Eliyahu Goldin" escribió:
    > > > > >
    > > > > > > You can find the names of the columns in the datagrid Columns

    > > property
    > > > > > > unless the grid is AutoGenerated.
    > > > > > >
    > > > > > > Eliyahu
    > > > > > >
    > > > > > > "dalbo" <> wrote in message
    > > > > > > news:...
    > > > > > > > Hello, I make a dataGrid and i like to show the name of the

    > > columns of
    > > > > the
    > > > > > > > dataGrid in a DropDownList. For example, if my dataGrid have

    three
    > > > > columns
    > > > > > > > called "NAME" "ADDRESS" "CITY" i like show "NAME" "ADDRESS"

    "CITY"
    > > in
    > > > > the
    > > > > > > > DropDownList.
    > > > > > > >
    > > > > > > > Thanks David, and sorry for my poor english.
    > > > > > >
    > > > > > >
    > > > > > >
    > > > >
    > > > >
    > > > >

    > >
    > >
    > >
    Eliyahu Goldin, Aug 24, 2005
    #8
    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. Luis Esteban Valencia
    Replies:
    7
    Views:
    563
    =?Utf-8?B?QmlsbCBCb3Jn?=
    Sep 29, 2004
  2. helpful sql
    Replies:
    0
    Views:
    807
    helpful sql
    May 19, 2005
  3. mavrick_101
    Replies:
    1
    Views:
    532
    Rajeev Gopal
    Jun 10, 2010
  4. rob thomson
    Replies:
    0
    Views:
    260
    rob thomson
    Sep 4, 2003
  5. ton
    Replies:
    2
    Views:
    205
    Alvin Bruney [MVP]
    Feb 11, 2004
Loading...

Share This Page