DropDownList show the name of columns of dataGrid

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

    Default DropDownList show the name of columns of dataGrid

    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 Guest

  2. Similar Questions and Discussions

    1. How to Hide & show the columns in ADVANCED DATAGRID.?
      HI, Am working with Advanced Datagrid. Problem am facing is.. i want to hide & show the columns in AdvancedDataGridColumnGroup. By default am...
    2. Does MS Access have a Show Columns SQL command
      I have recently discovered how to Alter Add and Drop columns from MS Access. This is going to help me a lot with updating multiple databases when I...
    3. Columns and Inherited Datagrid...Active Schema does not support columns
      I have a class which has inherited from datagrid, to provide some custom functionality, row select, mouse overs etc All is working fine apart from...
    4. can't get data to show with bound columns
      I'm trying to create a DataGrid filled with values from a DataSet and I want the user to be able to show and hide whichever columns they choose. I...
    5. Conditionally show columns in SQL
      Almost positive that this is impossible without using dynamic sql! -- Dean Savovic www.teched.hr "Pierre Dippenaar" <pierre@sentinal.co.za>...
  3. #2

    Default Re: DropDownList show the name of columns of dataGrid

    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" <dalbo@discussions.microsoft.com> wrote in message
    > news:4EBA8731-F9FD-4274-8945-633506CEA16F@microsoft.com...
    > > 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 Guest

  4. #3

    Default Re: DropDownList show the name of columns of dataGrid

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

    Eliyahu

    "dalbo" <dalbo@discussions.microsoft.com> wrote in message
    news:4EBA8731-F9FD-4274-8945-633506CEA16F@microsoft.com...
    > 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 Guest

  5. #4

    Default Re: DropDownList show the name of columns of dataGrid

    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" <dalbo@discussions.microsoft.com> wrote in message
    > news:4FFA0F4C-CF90-47FC-92FA-8B588CF87E40@microsoft.com...
    > > 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" <dalbo@discussions.microsoft.com> wrote in message
    > > > news:4EBA8731-F9FD-4274-8945-633506CEA16F@microsoft.com...
    > > > > 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 Guest

  6. #5

    Default Re: DropDownList show the name of columns of dataGrid

    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" <dalbo@discussions.microsoft.com> wrote in message
    news:4FFA0F4C-CF90-47FC-92FA-8B588CF87E40@microsoft.com...
    > 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" <dalbo@discussions.microsoft.com> wrote in message
    > > news:4EBA8731-F9FD-4274-8945-633506CEA16F@microsoft.com...
    > > > 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 Guest

  7. #6

    Default Re: DropDownList show the name of columns of dataGrid

    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" <dalbo@discussions.microsoft.com> wrote in message
    > news:5BE8B3EE-E544-4374-B9DA-50CF7527C263@microsoft.com...
    > > 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" <dalbo@discussions.microsoft.com> wrote in message
    > > > news:4FFA0F4C-CF90-47FC-92FA-8B588CF87E40@microsoft.com...
    > > > > 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" <dalbo@discussions.microsoft.com> wrote in message
    > > > > > news:4EBA8731-F9FD-4274-8945-633506CEA16F@microsoft.com...
    > > > > > > 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 Guest

  8. #7

    Default Re: DropDownList show the name of columns of dataGrid

    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" <dalbo@discussions.microsoft.com> wrote in message
    news:5BE8B3EE-E544-4374-B9DA-50CF7527C263@microsoft.com...
    > 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" <dalbo@discussions.microsoft.com> wrote in message
    > > news:4FFA0F4C-CF90-47FC-92FA-8B588CF87E40@microsoft.com...
    > > > 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" <dalbo@discussions.microsoft.com> wrote in message
    > > > > news:4EBA8731-F9FD-4274-8945-633506CEA16F@microsoft.com...
    > > > > > 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 Guest

  9. #8

    Default Re: DropDownList show the name of columns of dataGrid

    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" <dalbo@discussions.microsoft.com> wrote in message
    news:4E8FCEDB-2F77-49CF-951F-662C8353243A@microsoft.com...
    > 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" <dalbo@discussions.microsoft.com> wrote in message
    > > news:5BE8B3EE-E544-4374-B9DA-50CF7527C263@microsoft.com...
    > > > 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" <dalbo@discussions.microsoft.com> wrote in message
    > > > > news:4FFA0F4C-CF90-47FC-92FA-8B588CF87E40@microsoft.com...
    > > > > > 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" <dalbo@discussions.microsoft.com> wrote in message
    > > > > > > news:4EBA8731-F9FD-4274-8945-633506CEA16F@microsoft.com...
    > > > > > > > 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 Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139