J
John Walker
Hi, my gridview has a label field which I'm replacing with a dropdownlist at
the time of databind with this code:
Dim lblType As Label = CType(e.Row.FindControl("lbltype"), Label)
e.Row.Cells(Cnst.Cells.AccountType).Controls.Remove(lblType)
Dim ddlType As New DropDownList
ddlType.ID = "ddlType"
ddlType.Items.Add(New ListItem("test", "test"))
ddlType.Items.Add(New ListItem("Bill To", "BILLTO"))
ddlType.Items.Add(New ListItem("Acct Of", "ACCTOF"))
e.Row.Cells(Cnst.Cells.AccountType).Controls.Add(ddlType)
So, the dropdown displays in the browser, but on subsequent postbacks i
cannot reference that control:
Dim ddlType As DropDownList =
CType(gvr.Cells(Cnst.Cells.AccountType).FindControl("ddlType"), DropDownList)
gvr is the gridviewrow and the value of the dropdownlist is returning
"Nothing".... but when i'm not creating the dropdown programatically i am
able to reference it successfully.
What am i doing wrong??
Thanks,
John
the time of databind with this code:
Dim lblType As Label = CType(e.Row.FindControl("lbltype"), Label)
e.Row.Cells(Cnst.Cells.AccountType).Controls.Remove(lblType)
Dim ddlType As New DropDownList
ddlType.ID = "ddlType"
ddlType.Items.Add(New ListItem("test", "test"))
ddlType.Items.Add(New ListItem("Bill To", "BILLTO"))
ddlType.Items.Add(New ListItem("Acct Of", "ACCTOF"))
e.Row.Cells(Cnst.Cells.AccountType).Controls.Add(ddlType)
So, the dropdown displays in the browser, but on subsequent postbacks i
cannot reference that control:
Dim ddlType As DropDownList =
CType(gvr.Cells(Cnst.Cells.AccountType).FindControl("ddlType"), DropDownList)
gvr is the gridviewrow and the value of the dropdownlist is returning
"Nothing".... but when i'm not creating the dropdown programatically i am
able to reference it successfully.
What am i doing wrong??
Thanks,
John