Re: Multiple DropDownLists

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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@xxxxxxxxxxxxxxxx
Hi

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@xxxxxxxxxxxxxxxxxxxxxxx
ddl.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@xxxxxxxxxxxxxxxx
Hello

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






.



Relevant Pages

  • Re: Cant populate combobox list with 1 item
    ... I am populating combobox lists with the following code: ... > I have the ranges set up as named ranges, but for other purposes, i ...
    (microsoft.public.excel.programming)
  • Re: Multiple DropDownLists
    ... you're populating the ddl. ... Anothere thing - if you're populating any ddls in the Page_Load event, ... drop down lists below in the hierarchy because it fired exceptions. ... makes change to the selection above in the structure. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Multiple DropDownLists
    ... DropDownList ddl = new DropDownList; ... 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 ... text) in the drop down lists below in the hierarchy because it fired ... 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. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: best method for populating drop down list control?
    ... list appears) would substantially mitigate any runtime performance issues ... "best method" for populating the list. ... I have states and countries drop down lists that don't change ... > taking these out and populating the controls dynamically using the ...
    (microsoft.public.dotnet.framework.aspnet)
  • best method for populating drop down list control?
    ... I'd like to hear your thoughts on best methods for populating drop down list ... I have states and countries drop down lists that don't change ... taking these out and populating the controls dynamically using the ...
    (microsoft.public.dotnet.framework.aspnet)