Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to get the Selected text value (not the SelectedValu
Message
 
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Environment versions
Environment:
C# 3.0
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01335710
Message ID:
01335721
Views:
13
This turned out to be a very hard task. I had to save it in a hidden field to get it correctly.

>Hi everybody,
>
>I have a DropDown list. I have its value set to something else and the text set to the actual value. Now I'm having a problem to get this selected text back.
>
>I tried
>return this.ddlSchool.Items[this.ddlSchool.SelectedIndex].Text ;
>// but it returns the original value, not the actual selected text
>
>What could be the problem?
>
>I also have onchange attribute set to
>
>string script = "ChangePhone('" + this.lblSchoolPhone.ClientID + "', this.options[this.selectedIndex].value)";
>
>        this.ddlSchool.Attributes.Add("onchange", script);
>
>Could it be that having onchange JavaScript event somehow interferes with the value? It should not be.
>
>Any ideas welcomed because it's late and I need to get it done ASAP.
>
>Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform