I am trying to disable a list item in a drop down list.
The list looks something like
"Item 1
Other items that may interest you
Item 2
Item 3"
So items with an index of 1, 2 and 3 should not be selectable as I do not
want them to fire the onselectedindex change.
I know that there is an enabled property but that this does not apply to
dropdownlists.
Does anyone know of another way I can disable these items?
Thanks for your help. 4 2611
Just remove the unwanted items from the list, then users can't select them.
"KerryC" <Ke****@discuss ions.microsoft. comwrote in message
news:3A******** *************** ***********@mic rosoft.com...
>I am trying to disable a list item in a drop down list.
The list looks something like
"Item 1
Other items that may interest you
Item 2
Item 3"
So items with an index of 1, 2 and 3 should not be selectable as I do not
want them to fire the onselectedindex change.
I know that there is an enabled property but that this does not apply to
dropdownlists.
Does anyone know of another way I can disable these items?
Thanks for your help.
Obviously that would be nice but I need to keep them in there!
"schneider" wrote:
Just remove the unwanted items from the list, then users can't select them.
"KerryC" <Ke****@discuss ions.microsoft. comwrote in message
news:3A******** *************** ***********@mic rosoft.com...
I am trying to disable a list item in a drop down list.
The list looks something like
"Item 1
Other items that may interest you
Item 2
Item 3"
So items with an index of 1, 2 and 3 should not be selectable as I do not
want them to fire the onselectedindex change.
I know that there is an enabled property but that this does not apply to
dropdownlists.
Does anyone know of another way I can disable these items?
Thanks for your help.
I'm not aware of any way to do this in the way that you want. The only way
I can think of to do something like this is to handle it manually.
For instance if you don't want to allow "Item 2" to be selected, you could
use something like:
Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged
If ComboBox1.Selec tedItem.ToStrin g() = "Item 2" Then
ComboBox1.Selec tedIndex += 1
End Sub
Of course, this has a couple of problems such as incrementing past the last
item, etc. What you would have to do is keep track of the current value of
ComboBox - then depending on whether you allow the change, update the
manually tracked value and allow the change or manually set the combo box
back to the value stored previously.
HTH (as hokey as it is)
Possible use the Validation events, Causes Validation property?
"Matt F" <mf************ ****@nospam.nos pamwrote in message
news:eh******** ******@TK2MSFTN GP02.phx.gbl...
I'm not aware of any way to do this in the way that you want. The only
way I can think of to do something like this is to handle it manually.
For instance if you don't want to allow "Item 2" to be selected, you could
use something like:
Private Sub ComboBox1_Selec tedIndexChanged (ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles ComboBox1.Selec tedIndexChanged
If ComboBox1.Selec tedItem.ToStrin g() = "Item 2" Then
ComboBox1.Selec tedIndex += 1
End Sub
Of course, this has a couple of problems such as incrementing past the
last item, etc. What you would have to do is keep track of the current
value of ComboBox - then depending on whether you allow the change, update
the manually tracked value and allow the change or manually set the combo
box back to the value stored previously.
HTH (as hokey as it is)
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: MEM |
last post by:
hello,
I'd like to 'disable' an image link based on a value selected in a
drop down.
I currently have an image link that has the onclick event set to
execute a function.
For example:
|
by: Yoshitha |
last post by:
hi
I have 2 drop down lists in my application.1st list ontains itmes like
java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the
items like 50,60,70,80,90,100.
i will select any skill in 1st drop down list then i'll select % of this
skill in the 2nd list box , based on the percentage i've selected in the 2nd
list box it has to display
2 sets of drop down list boxes at run time one for selecting skill and
|
by: Dante |
last post by:
When your selected on a combo box, and hit F4, it shows
the drop down list.
So how do i stop the F4 key from bringing up the drop down
list on a combo box?
|
by: Ami Schreiber |
last post by:
I want to insert a default null ListItem with the text "choose an item ..."
in my DropDownList control. I have seen similar postings here regarding this
issue but all of them seem to focus around having to populate datasources,
datatables etc. and then bind the DropDownList in the codebehind of the .aspx
page. I am using Visual Studio 2005 and the .NET Framework 2.0. I thought
that with all these new improvements we could avoid all of the...
|
by: Mark Rae |
last post by:
Hi,
Has the <asp:DropDownList> - <asp:ListItem> functionality changed in v2? In
v1.1, the following works as expected:
<asp:DropDownList ID="cmbStatus" Runat=server EnableViewState=False>
<asp:ListItem Value=0> </asp:ListItem>
<asp:ListItem Value=1>Awaiting</asp:ListItem>
<asp:ListItem Value=2>Current</asp:ListItem>
<asp:ListItem Value=3>Terminated</asp:ListItem>
| |
by: kestrel |
last post by:
im making a drop down list, and i want to disable only certain options
how can i do this?
|
by: TycoonUK |
last post by:
Hi,
As I do not have IE7 on my computer, I was wondering if there is a
fault in my CSS Menu when using IE7.
Please can someone look at my site - http://www.worldofmonopoly.co.uk
and tell me if it works, and if it does not, tell me why it does not
work.
Thanks.
|
by: penny111 |
last post by:
Hi there,
For my application, i need to have 3 drop down lists
1. drop down list of folder names
2. drop down list of documents in the folder selected
3. drop down list of instances of the document selected
(my application uses the BusinessObjects Java Web Services SDK)
The 2nd list is dependent on the 1st, while the 3rd list is dependent on the 2nd. In other words, this is what i want my application to do
-select a folder from the...
|
by: bhavanirayala |
last post by:
Hi,
I want to disable drop down list according to the selection on radio buttons.
my code
<td > SEARCH </td>
<td><input type="radio" name="letterOption" ></td>
<td> <select name="letter"/> </td>
<td><input type="radio" name="fileOption" ></td>
<td> <select name="fileName"/> </td>
|
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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 we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |