Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 13th, 2007, 07:13 PM
Registered User
 
Join Date: Nov 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic Dropdownlists in a repeater

I’m working on a page that has 7 dropdownlists. When we direct a user to this page, all or some of these DDL’s are displayed to the user depending on their profiles.
The data for all these DDL’s comes from one DataSet.
My problem is as follows.

I want to add a repeater to the page and add 1 or more DDL’s dynamically to it depending on what we want to display.
For example user1 might need only the 3rd and 5th DDL’s. user2 might need all 7 DDL’s. user3 might not be able to view any dropdown lists at all.

Also user1 might have 3 options in DDL3 and 5 options in DDL5 . user 3 can have 6 options in DDL3 and 2 options in DDL5.
I mean the same DDL’s can have different options for different users.

So can anyone suggest how I can add dropdown lists dynamically to a repeater.

Thanks in advance for your help.


 
Old November 13th, 2007, 07:43 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

You could load all of the DDL's everytime and depending which ones you wanted to show you could always set the visible property to True or False.

DDL_1.Visible = False



 
Old November 14th, 2007, 02:47 PM
Registered User
 
Join Date: Nov 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your help. Your solution works in the current situation.

but we have about 90 different object classes which fill the drop down lists.

i have to provide a solution where more number of DDL's could also be generated upon request.

in short, the number of DDL's and the number of options in each DDL, both vary from user to user.

i'd appreciate it if you could suggest some way for me to solve this. moreover i'm still new to ASP.Net.



 
Old November 14th, 2007, 06:34 PM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 599
Thanks: 6
Thanked 3 Times in 3 Posts
Default

How do you know which DDL's you want to show? I understand your problem a little better now but from what I know its looking like there might be a better solution altogether.

So you not only want to show or hide specific DDL's but you also want to populate the DDL's content dependent on some input from the user? So I'm a little bit confused about what exactly you're trying to do. I'm wondering why the DDL's need to be in a repeater. Cause if you have only 7 DDL's you could have subs that populate them. If you didn't want to display DDL - 1 you could "IF" the sub to populate it and make it invisible. For the case of the change content you just need to alter the queries to reflect the values you need for the specific user and show those DDL's as visible.








Similar Threads
Thread Thread Starter Forum Replies Last Post
Dropdownlists in DetailsView irelandk BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 February 20th, 2007 10:13 AM
Callback in 3 DropDownLists Paula222 ASP.NET 2.0 Professional 3 December 13th, 2006 08:53 AM
Dynamic addtion of DropDownLists at Runtime DolphinBay ASP.NET 1.0 and 1.1 Professional 13 October 19th, 2005 11:11 PM
DropDownLists venterjo General .NET 1 January 8th, 2005 09:10 AM
Dynamic Template Repeater Find Control zac ASP.NET 1.0 and 1.1 Professional 0 October 9th, 2003 10:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.