L
Leona Vo via .NET 247
I was able to create dropdownlist dynamically and place them inplaceholder as follows:
for i = 0 to 5
Dim ShowDropDownList = New DropDownList
ShowDropDownList.Visible = True
ShowDropDownList.ID = "DropDownList" & i
ShowDropDownList.Style("position") = "absolute"
ShowDropDownList.Style("left") = "248px"
ShowDropDownList.Style("top") = j & "px"
PlaceHolder1.Controls.Add(ShowDropDownList)
next
I want to retrieve values from the dynamically created controls,in this case the dropdownlist controls. However, when the userclick on the submit button, the program no longer see thecontrols in PlaceHolder1. It appears that I have a view stateproblem, but I can't figure out a way around it. This is how Ireference the code and this is where I receive the error.
for i = 0 to 5
strWhereClause +=CType(PlaceHolder1.FindControl("DropDownList" & i),DropDownList).SelectedValue
next
Please help someone.
for i = 0 to 5
Dim ShowDropDownList = New DropDownList
ShowDropDownList.Visible = True
ShowDropDownList.ID = "DropDownList" & i
ShowDropDownList.Style("position") = "absolute"
ShowDropDownList.Style("left") = "248px"
ShowDropDownList.Style("top") = j & "px"
PlaceHolder1.Controls.Add(ShowDropDownList)
next
I want to retrieve values from the dynamically created controls,in this case the dropdownlist controls. However, when the userclick on the submit button, the program no longer see thecontrols in PlaceHolder1. It appears that I have a view stateproblem, but I can't figure out a way around it. This is how Ireference the code and this is where I receive the error.
for i = 0 to 5
strWhereClause +=CType(PlaceHolder1.FindControl("DropDownList" & i),DropDownList).SelectedValue
next
Please help someone.