set FormView's dropdownlist controls datasource dynamically

R

Rabbit

Hi, All,

I have a FormView, in which the InsertItemTemplate has a dropdownlist that I
need to set the datasource as my self created dataset.

I have been trying various syntax like following at formview Init or
ItemCreated event:
Dim cbo As DropDownList =
CType(Me.fmViewUser.Row.Cells(0).FindControl("ddNameInsert"), DropDownList)
or
Dim cbo As DropDownList =
CType(Me.fmViewUser.Row.FindControl("ddNameInsert"), DropDownList)

But I still can access such dropdownlist, and keeps prompting "Object
reference not set to an instance of object".

Has anyone got idea how to fix it? or telling me how to set a control inside
a formView Control?

Thanks in advnace
Keith
 

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
474,262
Messages
2,571,043
Members
48,769
Latest member
Clifft

Latest Threads

Top