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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top