how to set dropdown list value though a user control?

Hi Expert,

I have a test box and dropdown list on a user control. When user select dropdown list in another page which used this user control,  how to pass the value or index  to user contol?

code fragment in user control are here

Public Property FirstName() As String
        Get
            Return txtFName.Text
        End Get
        Set(ByVal value As String)
            txtFName.Text = value
        End Set
    End Property

Public Property Department() As String
        Get
            Return ddlDept.SelectedValue
        End Get
        Set(ByVal value As String)
            ddlDept.SelectedIndex = ddlDept.Items.IndexOf(ddlDept.Items.FindByValue(value))
      End Set
    End Property

Set first name works but department dropdown do not work.

Thanks in advance.

LVL 1
dshi15Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sm394Commented:
something like that
Public Property SelectedValue() As String
        Get
            Return ddlDept.SelectedValue
        End Get
        Set(ByVal value As String)
            ddlDept.SelectedValue = value
        End Set
    End Property
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dshi15Author Commented:
thanks,
I found out where is wrong,
Set(ByVal value As String)
            should be

Set(ByVal value As integer)
            ddlDept.SelectedValue = value
        End Set

I used deptId as value.

0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.