如何在 ASP.NET 面板中循环下拉列表?
我只需要获取面板中下拉列表的 selectedvalues 以及 ID
如何在 ASP.NET 面板中循环下拉列表?
For i = 0 To pnl.Controls.Count - 1
Dim ddl As DropDownList = CType(pnl.Controls(i)., DropDownList)
test = test & "[" & ddl.SelectedValue & "]"
Next
谢谢
I just need to get the selectedvalues as well as ID for dropdownlist in a panel
how to loop dropdownlist in a panel in ASP.NET?
For i = 0 To pnl.Controls.Count - 1
Dim ddl As DropDownList = CType(pnl.Controls(i)., DropDownList)
test = test & "[" & ddl.SelectedValue & "]"
Next
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
也许你可以尝试这个:
通常,你将
id
绑定为DropDownList
的value
Maybe you can try this:
usually, you are binding the
id
asvalue
ofDropDownList
不需要循环,因为您已经有了
DropDownList ddl
并且可以使用以下DropDownList
属性:请查看:http://msdn.microsoft.com/en-us/library/system.web.ui。 webcontrols.dropdownlist.aspx
No need for a loop and since you already have your
DropDownList ddl
and can use the followingDropDownList
properties:Check this out: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.dropdownlist.aspx
假设你的下拉菜单有一个 id,它是否包含在另一个控件中并不重要。 C# 代码看起来像这样:
Assuming your dropdown has an id it doesn't really matter if it is contained in another control. The C# code would look something like this: