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.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Vithal WadjePosted Oct 30, 2014, 11:29 AM
Riddhi ValechaPosted Oct 29, 2014, 5:30 AM
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.
---
sathishPosted Oct 29, 2014, 3:37 AM
I'm not clear about the SelectedValue alone , how it would be '-1' ??
Vithal WadjePosted Oct 28, 2014, 2:47 PM
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