473,462 Members | 1,128 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Q: select value in dropdown list

Hello,
I usee this to find string sD in drop down list and select the value.
dllSP.SelectedIndex = dllSP.Items.IndexOf(dllSP.Items.FindByText(sD);
Can I get FindByText work with wildcards? So dropdown list has xyzt, and if
sD is xyz, I need to select xyzt. Right now it does not select since is
expects whole match. How can I do this?
Thanks,
Jim.

Nov 19 '05 #1
1 2148
You will need to manually loop the items collection looking for the item you
seek. This is nearly exactly what the FindByText does.

for( int i = 0 ; i < dllSP.Items.Count ; i++ ) {
if ( ddlSP.Items[i].Text.StartsWith( "xyz" ) ) {
dllSP.SelectedIndex = i;
break;
}
}

bill

"JIM.H." <JI**@discussions.microsoft.com> wrote in message
news:69**********************************@microsof t.com...
Hello,
I usee this to find string sD in drop down list and select the value.
dllSP.SelectedIndex = dllSP.Items.IndexOf(dllSP.Items.FindByText(sD);
Can I get FindByText work with wildcards? So dropdown list has xyzt, and if sD is xyz, I need to select xyzt. Right now it does not select since is
expects whole match. How can I do this?
Thanks,
Jim.

Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rod Early | last post by:
I need to know when the select element's dropdown list is opened (as when the user clicks on the arrow or does ALT-downarrow from the keyboard). Similarly, I need to known when the dropdown list...
6
by: passion_to_be_free | last post by:
This is probably simple, but I can't seem to find it anywhere. I have have some values stored in javascript variables. I have a <select> dropdown list whose options correspond to these values. I...
2
by: DotNetJunkies User | last post by:
hi,, im trying to work out what code is needed for the below problem about databinding a dropdown list and having actual datalist items as value "0" ie 'please select' can anyone tell me how to...
4
by: beenamore | last post by:
Hi, I have two select lists and depending on the value selected in the first select dropdown, I want to populate the second list. I tired a couple of different ways, but for some reason, it...
1
by: Steve M. | last post by:
Hello all. I have a dropdown list: <select name="select" class="mapMenu" onChange="JumpToIt(this)"> <option selected value="none">Select a Tool --</option> <option...
4
by: =?Utf-8?B?c2lMdmVy?= | last post by:
Hhi, I'm working on an asp .net project that have small side panel which 'disallow' long SELECT/dropdown list.. So i could not force them to a certain that shows my longest option, which now...
2
by: bdbeames | last post by:
Ok, It has been one of those days. Here is my bump in the road. I have an add user form for the administrator. The administrator enters name, password and then selects access level from a...
1
by: ramya2611 | last post by:
hi I have the following scenario.. i have a select box containing a list of times. on selecting one of them i am dispalying all the details pertaining to that selection. the list is prone to...
0
acoder
by: acoder | last post by:
Problem The select object's add method doesn't append options to the end of the list. Browser Internet Explorer Example The Javascript code for appending an option element at the end of a...
0
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...
0
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...
0
jinu1996
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...
1
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...
0
tracyyun
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...
0
agi2029
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,...
0
isladogs
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...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.