比较下拉列表
我有一个页面包含多个下拉列表,所有下拉列表都填充了相同的值。我想在客户端和服务器端对它们进行比较。
但问题是,下拉列表是动态生成的,因为它们的数量可能会有所不同。
I'm having a page that contains several dropdownlists, all filled with the same values. I would like to compare them on the client as well as on the server side.
The problem is though, that the dropdownlists are generated dynamically because their quantity can vary.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
客户端比较:
经典服务器端与 C# 对比:
Client side comparing:
Classic server side comparing with C#:
您需要什么样的比较?如果您不将它们保存在列表中并将该列表保存在会话中,那么您将永远无法对它们执行任何操作,因为您是动态添加它们的。在创建下拉列表的位置添加下拉列表(当 Page.IsPostBack == false 时应该如此)并将该列表保留在会话中。在回发时,从列表中加载下拉列表。您可以使用您保留的列表来比较它们。
What kind of comparison do you need? If you don't keep them in a List and that list in Session, you can never do anything with them since you add them dynamically. Add your dropdownlists where you create them (this should me when Page.IsPostBack == false) and keep that list in session. On postbacks, load your dropdowns from the list. You can compare them using the list you keep.