473,406 Members | 2,954 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How to iterate over a Single dropdownlist in asp.net

144 100+
Hello to Everybody,

I have a dropdownlist by name "Subject" which contain C,C++,Java,Php
which is added by the following way

subject.items.add("C")
subject.items.add("C++")
subject.items.add("Java")
subject.items.add("Php")

In the same webform

i have a Textbox in that when user enter C or C++ or Java or Php

i have to check this textbox text with Subject dropdownlist(Normally Compare with every subject dropdownlist items)

and Say this

This Subject C or C++ or Java or Php have been entered in Subject dropdownlist.....

pl help me

Posted Date:- 19 Feb 2008

Davidson
Feb 19 '08 #1
4 1628
int08h
28
if (subject.FindByText("C++") != null) {
//then C++ exists in dropdownlits
}
Feb 19 '08 #2
davidson1
144 100+
it shows an error

Findbytext is not a member of dropdownlist

if we should import any namespace , just tell me............ or if u know any other coding just tell me..........................

Davidson

Posted Date:- 19 feb 2008
Feb 19 '08 #3
int08h
28
sorry i've made a mistake
the FindByText method belongs to ListItemCollection class, so the code should be

subject.Items.FindByText("C++")...
Feb 20 '08 #4
kunal pawar
297 100+
try this

DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.Fi ndByValue(<value>))
'DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.Fi ndByText(<Text>))
Feb 20 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: JDavies | last post by:
Hi All I am dynamically Creating DropDownList boxes for a Survey form. These DropdownLists are added to Table Cells programatically. I tried to loop thru the controls on the form but it doesnt...
3
by: Do | last post by:
Hi, How do I read through the items that are statically set in a dropdownlistbox? Usually, I have my items in a dataset before I bind to a control, so I can read the data. But if they're set...
3
by: Bill | last post by:
I have a seating chart web form that has over 50 entry field controls (tables/booths) where I use a DropDownList box to select a single company name from a single large list of organizations (200...
2
by: James Doran | last post by:
Hello, I'd like to iterate through each Page of my ASP.NET project from within a Custom web control and access the Page.Controls collection. I've tried using Reflection on the web project...
2
by: .Net Newbie | last post by:
Hello, I am currently coding my ASP.Net pages in c# and have run into a question concerning Emails. I have four objects on a page (six including 2 buttons). The first is a subject line...
1
by: Dan Sikorsky | last post by:
How do you recursively iterate thru each collection on each form on a web page and find each web control? -- Thank you kindly, Dan Sikorsky BAB, BScE, MSC
3
by: John Blair | last post by:
Hi, I want to select an id column and a name column from the database and have the results databound to a SINGLE dropdown control with the value property matched to the database id column and...
1
by: AC | last post by:
Hello, All Is it possible to set enableViewState='true' for single control on a page with enableViewState='false'. In particular I am interested in DropDownList, but neither using IDE to set...
1
by: davidson1 | last post by:
Hello to Everybody, I have a dropdownlist by name "Subject" which contain C,C++,Java,Php which is added by the following way subject.items.add("C") subject.items.add("C++")...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
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,...
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
Oralloy
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,...
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...

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.