简体   繁体   English

ASP.NET MVC三态复选框服务器控件

[英]ASP.NET MVC Tri State Check box Server Control

I have a requirement where in i need to use tri-state check box. 我有一个要求,我需要使用三态复选框。 I am constructing a T-SQL query based on the selected state of the check box. 我正在基于复选框的选定状态构造一个T-SQL查询。 My requirement is as follows 我的要求如下

If check box checked - I need to use the clause - IN (Checked Value) in query If the check box is not checked i need to ignore the check box value in query. 如果复选框已选中-我需要在查询中使用子句-IN(校验值)如果未选中该复选框,则需要忽略查询中的复选框值。 If the check box is in indeterminate state - i need to use NOT IN (Checked value) 如果复选框处于不确定状态-我需要使用NOT IN(已检查值)

I have gone through multiple sites but didn't get tri-state check box details apart from tri state check box trees 我遍历了多个站点,但是除了三态复选框树之外没有三态复选框的详细信息

Can anyone help me in achieving this? 谁能帮助我实现这一目标?

Thanks in advance 提前致谢

If I understand the problem correctly, you have the following three states: - Never checked - Checked - Unchecked 如果我正确理解了该问题,则您处于以下三种状态:-从未检查-已检查-未检查

In order to achieve what you need I would add an addition hidden field to hold the actual state value and use it at the controller level. 为了实现您需要的功能,我将添加一个附加的隐藏字段来保存实际状态值,并在控制器级别使用它。 You will also need to add a little bit of javascript to handle the three states and sync the checkbox values with the hidden field. 您还需要添加一些JavaScript来处理这三种状态,并将复选框值与隐藏字段同步。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM