any gridview experts out there!

Discussion in 'ASP .Net' started by Paul, Jun 12, 2008.

  1. Paul

    Paul Guest

    Not sure if this is possible with a gridview but I have several template
    columns and if possibly I want to conditionally add a second dropdownbox to
    the same column, for each row. For example column 1 contains a dropdown box
    called buildings and is loaded by a an object data source. This works fine
    but with some of the data there will be a group of rooms for some buildings
    so when the user selects a particular building that contains a room subset I
    would like to then have the room dropdown box appear with the corresponding
    rooms, in the same column of the building dropdown. It looks easy to do in
    its' own column but I am running out of space. Not sure if you can have two
    controls in a single template column or if there is another way to do this,
    using vs2005 C#?
    Thanks.
    --
    Paul G
    Software engineer.
    Paul, Jun 12, 2008
    #1
    1. Advertising

  2. Paul

    Manish Guest

    Hi Paul,

    You can have two dropdownlist control in the same template column and you
    can dynamically add another dropdownlist and on its selectedIndexChanged
    event bind it to the another datasource based on the value selected in the
    first dropdown. Please make sure that you have unique ids of the control in
    the same Template column. you will have to dynamically assign unique id to
    the Dropownlist control.

    Regards,
    Manish
    www.ComponentOne.com



    "Paul" wrote:

    > Not sure if this is possible with a gridview but I have several template
    > columns and if possibly I want to conditionally add a second dropdownbox to
    > the same column, for each row. For example column 1 contains a dropdown box
    > called buildings and is loaded by a an object data source. This works fine
    > but with some of the data there will be a group of rooms for some buildings
    > so when the user selects a particular building that contains a room subset I
    > would like to then have the room dropdown box appear with the corresponding
    > rooms, in the same column of the building dropdown. It looks easy to do in
    > its' own column but I am running out of space. Not sure if you can have two
    > controls in a single template column or if there is another way to do this,
    > using vs2005 C#?
    > Thanks.
    > --
    > Paul G
    > Software engineer.
    Manish, Jun 12, 2008
    #2
    1. Advertising

  3. You can include another dropdown to the same template and keep it hidden
    until user selects the particular building. In the event that handles user
    selection check the logic for enabling the other ddl.

    --
    Eliyahu Goldin,
    Software Developer
    Microsoft MVP [ASP.NET]
    http://msmvps.com/blogs/egoldin
    http://usableasp.net


    "Paul" <> wrote in message
    news:...
    > Not sure if this is possible with a gridview but I have several template
    > columns and if possibly I want to conditionally add a second dropdownbox
    > to
    > the same column, for each row. For example column 1 contains a dropdown
    > box
    > called buildings and is loaded by a an object data source. This works
    > fine
    > but with some of the data there will be a group of rooms for some
    > buildings
    > so when the user selects a particular building that contains a room subset
    > I
    > would like to then have the room dropdown box appear with the
    > corresponding
    > rooms, in the same column of the building dropdown. It looks easy to do
    > in
    > its' own column but I am running out of space. Not sure if you can have
    > two
    > controls in a single template column or if there is another way to do
    > this,
    > using vs2005 C#?
    > Thanks.
    > --
    > Paul G
    > Software engineer.
    Eliyahu Goldin, Jun 12, 2008
    #3
  4. Paul

    Paul Guest

    Hi thanks for the responses, looks like I was able to add a secondary
    dropdown list. So thinking for the hidden list the default visible with be
    false, just wondering what the event would be for the first drowdown to make
    the second one visible? If they were outside the grid it would just be the
    click event for the first dropdown.
    --
    Paul G
    Software engineer.


    "Manish" wrote:

    > Hi Paul,
    >
    > You can have two dropdownlist control in the same template column and you
    > can dynamically add another dropdownlist and on its selectedIndexChanged
    > event bind it to the another datasource based on the value selected in the
    > first dropdown. Please make sure that you have unique ids of the control in
    > the same Template column. you will have to dynamically assign unique id to
    > the Dropownlist control.
    >
    > Regards,
    > Manish
    > www.ComponentOne.com
    >
    >
    >
    > "Paul" wrote:
    >
    > > Not sure if this is possible with a gridview but I have several template
    > > columns and if possibly I want to conditionally add a second dropdownbox to
    > > the same column, for each row. For example column 1 contains a dropdown box
    > > called buildings and is loaded by a an object data source. This works fine
    > > but with some of the data there will be a group of rooms for some buildings
    > > so when the user selects a particular building that contains a room subset I
    > > would like to then have the room dropdown box appear with the corresponding
    > > rooms, in the same column of the building dropdown. It looks easy to do in
    > > its' own column but I am running out of space. Not sure if you can have two
    > > controls in a single template column or if there is another way to do this,
    > > using vs2005 C#?
    > > Thanks.
    > > --
    > > Paul G
    > > Software engineer.
    Paul, Jun 12, 2008
    #4
    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. Ira Lee
    Replies:
    0
    Views:
    722
    Ira Lee
    Jun 29, 2004
  2. Replies:
    3
    Views:
    1,109
    techmania
    Sep 26, 2007
  3. Richard Latter
    Replies:
    2
    Views:
    2,887
    Julie
    May 17, 2004
  4. dss
    Replies:
    2
    Views:
    379
  5. Jim Freeze
    Replies:
    9
    Views:
    134
    YANAGAWA Kazuhisa
    Oct 21, 2003
Loading...

Share This Page