RadhaKrishnaKiJaya
asked on
ASP.NET Dropdown list
Hi Experts,
How to display a value in the dropdownlist . I have a dropdown list where I have 2 values. 'Yes' and 'No'. But sometimes I need to display the value from the DB. Right now I am using this code.
If Reader.Item("Active") = "Y" Then
ddlCustActive.SelectedItem .Text = "Yes"
Else
ddlCustActive.SelectedItem .Text = "No"
End If
It is working. but changing the selected item text in the list and displaying either two 'yes' or two 'no'
Thanks.
How to display a value in the dropdownlist . I have a dropdown list where I have 2 values. 'Yes' and 'No'. But sometimes I need to display the value from the DB. Right now I am using this code.
If Reader.Item("Active") = "Y" Then
ddlCustActive.SelectedItem
Else
ddlCustActive.SelectedItem
End If
It is working. but changing the selected item text in the list and displaying either two 'yes' or two 'no'
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for your reply. But neither of the solution is working.
ASKER
I changed the code little bit and it worked.
ddlCustActive.SelectedValu e = ddlCustActive.Items.FindBy Text("Yes" ).Value
Thank you so much for your help.
ddlCustActive.SelectedValu
Thank you so much for your help.
ddlCustActive.SelectedValue = "Yes"
Else
ddlCustActive.SelectedValue = "No"
End If