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/archi...9/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 6 1968
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" <ig***@live.comwrote in message
news:22**********************************@microsof t.com...
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/archi...9/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
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@dw.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
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" <ig***@live.comwrote in message
news:22**********************************@microsof t.com...
>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/archi...9/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
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" <ig***@live.comwrote in message
news:0D**********************************@microsof t.com...
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@dw.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>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" <ig***@live.comwrote in message news:22**********************************@microso ft.com...
>>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/archi...9/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
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@dw.comwrote in message
news:O8**************@TK2MSFTNGP02.phx.gbl...
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" <ig***@live.comwrote in message
news:0D**********************************@microsof t.com...
>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@dw.comwrote in message news:%2****************@TK2MSFTNGP04.phx.gbl...
>>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" <ig***@live.comwrote in message news:22**********************************@micros oft.com... 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/archi...9/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
Would something like the following work?
DropDownList ddl = new DropDownList();
ListItem li = new ListItem("--select item--");
ddl.Items.Insert(li);
On Thu, 12 Jun 2008 13:57:18 -0300, Igor <ig***@live.comwrote:
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@dw.comwrote in message
news:O8**************@TK2MSFTNGP02.phx.gbl...
>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" <ig***@live.comwrote in message news:0D**********************************@microso ft.com...
>>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@dw.comwrote in message news:%2****************@TK2MSFTNGP04.phx.gbl.. . 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" <ig***@live.comwrote in message news:22**********************************@micro soft.com... 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/archi...9/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
--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Perhaps you can use this free control to make your life easier: http://www.asp.net/AJAX/AjaxControlT...gDropDown.aspx
--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider http://SteveOrr.net http://iPhonePlaza.net
"Igor" <ig***@live.comwrote in message
news:22**********************************@microsof t.com...
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/archi...9/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
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: theo |
last post by:
Hello..I have a similar issue as yesterday but the situation has
slightly changed so perhaps someone can shed some more light on the
issue...
Program flow - load file,extract xml text tags from...
|
by: Craig Buchanan |
last post by:
I would like to reuse a SQLDataReader that is populated with information as
the datasource for multiple dropdownlists. Unfortunately, the first DDL
closes the SDR and my code fails on the second...
|
by: Harry |
last post by:
Hi,
Quick question regarding dropdownlists.
On one page I have 10 asp:dropdownlists.
The user selects an option from a dropdown list and then it updates an
asp:label with the relevant text....
|
by: Angel.Net |
last post by:
I'm working with 40 dropdownlists that are selected on the the first page and each selection is sent to another Web Page's textboxes. I'd like to loop thru my first page's dropdown's and match them...
|
by: Timm |
last post by:
I have an ASP.NET 2.0 page with two DropDownLists. I am using declarative
data binding wherever possible and trying to minimize the use of code. The
list of values in DropDownList DDL2 should be...
|
by: ads |
last post by:
hi,
after binding the dropdownlist to a datasource, ive experience this error
"Cannot have multiple items selected in a dropdownlist" after using the code:...
|
by: Ranginald |
last post by:
This question is about how to handle an .aspx page that references
multiple methods and where to store these methods (e.g. one codefile or
multiple codefiles).
PREFACE
========
I have a simple...
|
by: RSH |
last post by:
Hi,
I am having this very bizarre occurance with 4 dropdown lists on my ASP .Net
page.
Each control has its own unique id. When the user selects a value from each
of the dropdownlists it is...
|
by: =?Utf-8?B?TWFkaXNvbg==?= |
last post by:
Hi all,
Could I use the sqldatasource with stored-procedure to return multiple
recordset? I did not want to have any sqldatasourec in the one page just to
return the record back to...
|
by: klaul |
last post by:
I've been trying to do this for a day and a half now, and am clearly getting nowhere!
The database I'm using is used to keep a log of service calls to various companies. When the user inserts data,...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |