Urgent - Please help

J

Julia Hu

Hi,
I use PlaceHolder control to load DropDownList and
TextBox into DataGrid programmatically.Then I need to
retrieve data from the DropDownList and TextBox. When I
use "FindControl" method, I can "FindControl" the
PlaceHolder,but I cannot "FindControl" the DropDownlist
or the TextBox, it returns Nothing to me.

Code to load control:
Private Sub grdAI_ItemDataBound()
.......
Dim plcAI As PlaceHolder = CType(e.Item.FindControl
("plcAI"), PlaceHolder)
Dim ddlAI As New DropDownList
ddlAI.ID = "ddlAI"
ddlAI.Items.Add("aa")
ddlAI.Items.Add("bb")
ddlAI.Items.Add("cc")
plcAI.Controls.Add(ddlAI)
End sub

Dim plc As New PlaceHolder
For i=0 to n
plc = CType(grdAI.Items(i).Cells(1).FindControl
("plcAI"), PlaceHolder)
Dim ddl As DropDownList = CType(plcAI.FindControl
("ddlAI"), DropDownList)
Next i

Thanks a lot,
Julia
 

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,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top