Please let me know the difference between
1.SelectedIndex
2.SelectedText
3.SelectedItem
4.SelectedValue
Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Vithal WadjeRank #19 · 47.2K reputationPosted Oct 28, 2014, 10:47 AM EDT
2.SelectedText-it will select text
3.SelectedItem-it will select text\value
4.SelectedValue -it will select value
e.g
the above dropdownlist will look like as
if i use
output will be- 0
output will be- MumbaiSelectedText for mumbai
- SelectedItem.Tostring() for mumbai,also it has SelectedItem.Text and SelectedItem.Value properties
output will be- Mumbai- SelectedItem.Text() for mumbai
output will be- Mumbai- SelectedItem.Value() for mumbai
output will be- 1output will be- 1
i hope you have understand
sathishRank #4,713 · 329 reputationPosted Oct 28, 2014, 11:37 PM EDT
I'm not clear about the SelectedValue alone , how it would be '-1' ??
Riddhi ValechaRank #794 · 2.9K reputationPosted Oct 29, 2014, 1:30 AM EDT
SelectedItem is for ListItem and
SelectedValue is for String Values.
--------
If the values in DDL (DropDownList) are of ListItem type, then user SelectedValue property.
If the values are of String type, then use SelectedValue property.
---
Vithal WadjeRank #19 · 47.2K reputationPosted Oct 30, 2014, 7:29 AM EDT