Re: Multiple DropDownLists
- From: "Igor" <igorm@xxxxxxxx>
- Date: Thu, 12 Jun 2008 18:57:18 +0200
Still don't know how to get the first item to be "--select value--" in code behind if I cannot use the <asp:ListItem Text="-- select value --" Value="">.
"David Wier" <dw@xxxxxx> wrote in message news:O8XAiRKzIHA.4492@xxxxxxxxxxxxxxxxxxxxxxx
You should put it anywhere you need it, in any event handler, just before you're populating the ddl.
Anothere thing - if you're populating any ddls in the Page_Load event, be sure to surround that population with an if/then/Postback block
David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no bloated markup
"Igor" <igorm@xxxxxxxx> wrote in message news:0D236198-A615-46CB-8100-F8982695CB8E@xxxxxxxxxxxxxxxxHi
I didn't make myself clear enough. Where should I put it in the code ? I tried putting it in SelectedIndexChanged events of particular drop down lists as well as PageLoad event but than I had a problem with a statement that selects first item (the one with "--select item --" text ) in the drop down lists below in the hierarchy because it fired exceptions. By ddl.items.clear the first item, the "--select item--" is also cleares, and it is not added again in postbacks.
Kind regars
IgorM
"David Wier" <dw@xxxxxx> wrote in message news:%23GwEyeJzIHA.2208@xxxxxxxxxxxxxxxxxxxxxxxddl.items.clear
David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no bloated markup
"Igor" <igorm@xxxxxxxx> wrote in message news:22BA969D-A3F0-4AF7-B786-EC9B40183279@xxxxxxxxxxxxxxxxHello
I have the following problem. I have three drop down lists on my page. They are filled with data from a database. Initially only the first one is enabled. The next one is enebled when user selects an item from the first one -- it is then filled with data specific to the selection in the drop down list above. The same with the third one. For each drop down list the first item is always "--select an item--" (as described here: http://weblogs.asp.net/scottgu/archive/2006/01/29/436804.aspx). To enable that I had to set the AppendDataBoundItems property for all three drop down lists to "true". Unfortunatelly, when a user selects an item from the first drop down list, the second one gets filled with item "--select an item--" and data from the database. But if the user changes their mind and selects different item from the first list (or list above in the structure) the next drop down list gets filled with new data, but, because of the AppendDataBoundItems property set to "true", previous data remains in the list. Thus, I must clear list(s) when user makes change to the selection above in the structure. How can I do this?
Kind regards
IgorM
.
- Follow-Ups:
- Re: Multiple DropDownLists
- From: Mark Elliott
- Re: Multiple DropDownLists
- References:
- Re: Multiple DropDownLists
- From: David Wier
- Re: Multiple DropDownLists
- From: Igor
- Re: Multiple DropDownLists
- From: David Wier
- Re: Multiple DropDownLists
- Prev by Date: Re: loop in a SQL stored procedure
- Next by Date: Re: Multiple DropDownLists
- Previous by thread: Re: Multiple DropDownLists
- Next by thread: Re: Multiple DropDownLists
- Index(es):
Relevant Pages
|