开发者

ASP.Net Selected Item in dynamic drop-down

开发者 https://www.devze.com 2023-01-20 03:15 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消