DropDownList

S

shapper

Hello,

I created a DropDownList as follows:

With ddlRole.Items
.Add("---")
.Add(New ListItem("Administrator", "Admin")
.Add(New ListItem("Collaborator", "Coll")
.Add(New ListItem("User", "Us")
End With

I need to defined the current Selected item as the one which value is
equal to the value of variable ROLE.

For example, if ROLE = "Admin" then I want the visible item in the
DropDownList to be:

.Add(New ListItem("Administrator", "Admin")

How can I do this?

Thanks,

Miguel
 
G

Guest

Hi,
Try this code:
ddlRole.selectedindex = ddlRole.FindString("Admin")
Hope this helps you out.

Thanks and Regards,
Manish Bafna.
MCP and MCTS
 
S

shapper

Hi,
Try this code:
ddlRole.selectedindex = ddlRole.FindString("Admin")
Hope this helps you out.

Thanks and Regards,
Manish Bafna.
MCP and MCTS

I get the error:
"FindString" is not a member of DropDownList
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top