根据客户ID自动选择数据网格中的复选框 [英] Autoselect checkbox in a datagrid based on customer id

查看:96
本文介绍了根据客户ID自动选择数据网格中的复选框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



我有一个要求,我有一个数据网格。在datagird中我有一个复选框列和其他列,其中一个是客户ID,我需要的是如果我选择针对客户ID 101的复选框,它应该自动选择其他具有客户ID 101的复选框。相同的数据网格,如果我取消选择101,它应该取消选择客户ID 101的所有复选框。请帮助

Hi there,

I have a requirement where I have a datagrid. In the datagird i have a checkbox column and other columns in which one of them is customer id, What i need is if I select the checkbox against the customer id 101, it should autoselect the other checkboxes which are having the customer id 101 in the same datagrid and if i unselect 101, it should unselect all checkboxes for customer id 101. Please help

推荐答案

向Grid添加复选框时,还要在其中添加一个CustomerID属性。

因此,当您选中/取消选中任何复选框时,请找到它的CustomerID并使用jQuery 选择器 [ ^ ]查找具有相同CustomerID的其他复选框并选中/取消选中他们。



检查jsFiddle上的样本

http:/ /jsfiddle.net/xqQUr/ [ ^ ]
While adding checkbox to Grid also add one attribute for CustomerID in it.
So when you check/uncheck any checkbox then find CustomerID of it and using jQuery selectors[^] find other checkboxes having same CustomerID and check/uncheck them.

Check sample on jsFiddle
http://jsfiddle.net/xqQUr/[^]


您使用的是INotifyPropertyChanged ...如果是这样,请将复选框的Checked属性绑定到自动更新值的属性...

有关tis的更多信息,请查看此链接

http ://codepronet.blogspot.com/2009/08/implementing-inotifypropertychanged.html [ ^ ]



使用INotifyPropertyChanged更好地绑定 [ ^ ]



否则,在复选框的OnCheckedChanged()事件中,您需要遍历所有项目网格和改变他们的选择manuall y
are you using INotifyPropertyChanged...if so bind the Checked property of the checkbox to a property which automatically updates the values ...
For more info on tis, plz check this link
http://codepronet.blogspot.com/2009/08/implementing-inotifypropertychanged.html[^]

Bind Better with INotifyPropertyChanged[^]

Else on OnCheckedChanged() event of the checkbox, you need to go through all the items in a grid and change their selection manually


我的想法很少使用Jquerys和我进入.net 2003.我正在尝试使用复选框的OnCheckedChanged()事件。但是我没有弄清楚如何自动选择基础客户ID。
I have very less idea on using Jquerys nd I m into .net 2003. Am trying with OnCheckedChanged() event of the checkbox. But I am not getting the logic on how to autoselect base don customer id.


这篇关于根据客户ID自动选择数据网格中的复选框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆