ASP.Net Selected Item in dynamic drop-down
I'm trying to make the selected item the value of an asp:Label
if this is possible
I am putting my drop down list in like this
For ddlAdults As Integer = 1 To strNumberSlept
CType(e.Item.FindControl("ddlEditAdults"), dropdownlist).Items.Add(new ListItem(ddlAdults.ToString(), ddlAdults.ToString()))
Next ddlAdults
And I need to add a selected item in to be the value of strSelectedItem
Dim strSelectedItem = CType(e.Item.FindControl("lblAdults"), label).Text
Not sure how to add this in dynamically 开发者_JAVA技巧
Any ideas?
Thanks
Jamie
I've figured it out
CType(e.Item.FindControl("ddlEditAdults"), dropdownlist).SelectedValue = CType(e.Item.FindControl("lblAdults"), label).Text
Thanks
Jamie
精彩评论