For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > June 2008 > any gridview experts out there!









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author any gridview experts out there!
Paul

2008-06-11, 7:34 pm

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

2008-06-12, 4:58 am

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.

Eliyahu Goldin

2008-06-12, 8:46 am

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" <Paul@discussions.microsoft.com> wrote in message
news:6C8B455F-65E1-41D8-AAE2-6D42548F4010@microsoft.com...
> 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

2008-06-12, 7:37 pm

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:
[color=darkred]
> 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:
>
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com