473,770 Members | 5,569 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DropDownList values are case sensitive?


Say I have a dropdownlist control of the US State Codes
<asp:dropdownli st id=ddlStateCode ...>
<asp:listitem value="AL">Alab ama</asp:listitem>
<asp:listitem value="CA">Cali fornia</asp:listitem>
etc...
In my codebehind, I have something like this:

ddlStateCode.Se lectedValue = UserRecord.Stat eCode
the problem is that if the UserRecord.Stat eCode is not in caps, I get an
error. In other words, the 'SelectedValue' property is case sensitive.

I have tried using 'OPTION COMPARE TEXT' but it didn't help.

Is there a way of making it NOT be case sensitive?

Nov 17 '05 #1
1 6989
Hi Boban,

Please try changing your code to something like this:
If ddlStateCode.Se lectedValue.ToU pper() = UserRecord.Stat eCode.ToUpper()
Then

Thank you, Mike
Microsoft, ASP.NET Support Professional

Microsoft highly recommends to all of our customers that they visit the
http://www.microsoft.com/protect site and perform the three straightforward
steps listed to improve your computer’s security.

This posting is provided "AS IS", with no warranties, and confers no rights.
--------------------
From: "Boban Dragojlovic" <news@_N_O_S_P_ AM_dragojlovic. org>
Newsgroups: microsoft.publi c.dotnet.framew ork.aspnet
Subject: DropDownList values are case sensitive?
Lines: 22
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
Message-ID: <YN************ **@newssvr14.ne ws.prodigy.com>
NNTP-Posting-Host: 207.48.25.3
X-Complaints-To: ab***@prodigy.n et
X-Trace: newssvr14.news. prodigy.com 1068132600 ST000 207.48.25.3 (Thu, 06 Nov 2003 10:30:00 EST) NNTP-Posting-Date: Thu, 06 Nov 2003 10:30:00 EST
Organization: SBC http://yahoo.sbc.com
X-UserInfo1: TSU[@SNEQJBQW^MSX@^ DM^P@VZ\LPCXLLB WLOOAFEQR@ETUCC NSKQFCY@TXDX_WH SVB]ZEJLSNY\
^J[CUVSA_QLFC^RQHU PH[P[NRWCCMLSNPOD_ES ALHUK@TDFUZHBLJ \XGKL^NXA\EVHSP[D_C^B_^
JCX^W]CHBAX]POG@SSAZQ\LE[DCNMUPG_VSC@VJM Date: Thu, 06 Nov 2003 15:30:00 GMT
Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!new sfeed00.sul.t-online.de!t-onlin
e.de!newsfeed.i cl.net!newsfeed .fjserv.net!col t.net!news.maxw ell.syr.edu!in. 1
00proofnews.com !in.100proofnew s.com!prodigy.c om!newsmst01.ne ws.prodigy.com! p
rodigy.com!post master.news.pro digy.com!newssv r14.news.prodig y.com.POSTED!84 0
fc3d7!not-for-mail Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.framew ork.aspnet:1890 16
X-Tomcat-NG: microsoft.publi c.dotnet.framew ork.aspnet
Say I have a dropdownlist control of the US State Codes
<asp:dropdownli st id=ddlStateCode ...>
<asp:listitem value="AL">Alab ama</asp:listitem>
<asp:listitem value="CA">Cali fornia</asp:listitem>
etc...
In my codebehind, I have something like this:

ddlStateCode.Se lectedValue = UserRecord.Stat eCode
the problem is that if the UserRecord.Stat eCode is not in caps, I get an
error. In other words, the 'SelectedValue' property is case sensitive.

I have tried using 'OPTION COMPARE TEXT' but it didn't help.

Is there a way of making it NOT be case sensitive?


Nov 17 '05 #2

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

Similar topics

1
1546
by: Kathy Burke | last post by:
I know that elements and attribute names are case sensitive, but are the actual attribute values case sensitive when referred to from within an xsl stylesheet for example? Thanks, Kathy *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
18
2456
by: Julia Hu | last post by:
Hi, I have a datagrid, and in different rows I need to programmatically bind different type of controls and load data into these controls. For example,in the first row I need to bind data into a textbox, and in the second row I need to bind data into a dropdownlist...It all depends on the data I select from the database. I cannot use TemplateColumn because it has to be the same type of control for one column.
10
5325
by: Sacha Korell | last post by:
I'm trying to load a drop-down list with all DropDownList control names from another page. How would I be able to find those DropDownList controls? The FindControl method will only find a certain control by id, but I want to find all controls of a certain type (DropDownList in this case). Is there an easier way than to get a control count of the page, loop through all controls on that page, examine their type and, if they're a...
2
2023
by: jason | last post by:
Pardon my ignorance on this. The below code works, except, when I edit a record and update the two drop downs take the first entry in the dropdownlist if not selected. I'd also like the dropdown to show the current value in edit mode. I'm sure this is a common question. I've reviewed several related post and tried them out to no avial. Some of the offerings in listgroup look right on, but are not clear on where to handle the suggested...
4
2032
by: ^MisterJingo^ | last post by:
Hi all, I have a web page which has a single dropdownlist containing 3 items. Below the dropdownlist are two listboxes. Depending on the option selected from the dropdownlist, the left most listbox populates itself from a DB table, assigning the correct id to each item as a value. In between the listboxes are two buttons. On clicking an 'add' button, I am trying to grab the id of the item selected (the goal being to place this id and...
12
1689
by: Frederik Vanderhaeghe | last post by:
Hi, I have a dropdownlist that contains should contain several values from the database, I fill it up in de page_load() with this code: If Not Page.IsPostBack Then InlezenConfig() Dim strsqlDocType As String = "select distinct type from TBL_Bestanden_Zoeken"
3
2494
by: Carlos Lozano | last post by:
Hello, I am having a problem getting the selectedValue from a dropdownlist that is populated with a dataReader and just can't see the problem. I did the following: dim dr as DataReader dr = DataReader(sSQLcmd) Me.DropDownList1.DataSource = dr
0
1329
by: brian.newman | last post by:
I've created a dropdownlist whose values are drawn from an Access database. This list of items represents a user account. In the same record is a boolean field which records whether the user is an administrator. On my web form, I want a checkbox labelled "Is Admin" which will take the appropriate value from the Access database depending on which value is chosen in the dropdownlist. I'm using a checkboxlist in this case as it has...
8
332
by: Rick | last post by:
I have been trying to get this dropdownlist to run and I am having nothing but errors. Anyone know what I am doing wrong? Any help would be much appreciated!!! Here is my code. <script runat="server"> Public Sub Page_Load(sender as Object, e as EventArgs) Dim conClsf As OleDbConnection
0
9592
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10231
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, 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...
0
10059
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 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...
0
8887
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, 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...
1
7416
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6679
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();...
0
5452
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3972
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
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.