Home All Groups Group Topic Archive Search About

How do you set the value of Drop Down User Control

Author
2 Jun 2005 6:25 PM
Paul D. Fox
I'm using a User Control to display a drop-down and when I "Edit" a screen,
I want to set the Drop-Downs value to the value obtained from the Database.
Something like:

ddlUserControl.ControlID.Insert(0,drReader("EmployeeName"))  which doesn't
seem to work.  Help!

Paul

Author
3 Jun 2005 6:36 PM
Visar Gashi, MCP
Why don't you just simply set the selected value:

ddlUserControl.SelectedValue = drReader("EmployeeName").ToString();

That is assuming that the value exists on the list.

Regards,
-Visar

Show quoteHide quote
"Paul D. Fox" wrote:

> I'm using a User Control to display a drop-down and when I "Edit" a screen,
> I want to set the Drop-Downs value to the value obtained from the Database.
> Something like:
>
> ddlUserControl.ControlID.Insert(0,drReader("EmployeeName"))  which doesn't
> seem to work.  Help!
>
> Paul
>
>
>