Urgent - Please help

  • Thread starter Thread starter Julia Hu
  • Start date Start date
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
 
Back
Top