电脑弹出You checked too many connectionsboxes 是什么原因?

C# 如果把ListView的CheckBoxes的值设为false, ItemChecked事件不被触发_百度知道
C# 如果把ListView的CheckBoxes的值设为false, ItemChecked事件不被触发
用什么办法即不用把CheckBoxes设为true,又可以触发ItemChecked的事件呢?
提问者采纳
在你需要触发ItemChecked事件的地方加入以下代码:listView1_ItemCheck(listView1,new ItemCheckEventArgs(0,CheckState.穿鼎扁刮壮钙憋水铂惊Unchecked,CheckState.Unchecked ));
提问者评价
谢谢你的帮助,通过你的思路解决了问题。
其他类似问题
为您推荐:
listview的相关知识
其他2条回答
貌似不可能,如果选中就执行选中时间,那你的电脑估计要承受很大的压力啊
你可以把ItemChecked事件写在别的事件里面,也是一样可以触发的
等待您来回答
下载知道APP
随时随地咨询
出门在外也不愁my experiments with //Web
An update to this post is available at
with suggestions from the comments below and it works when I last checked in IE 8 Beta2, Firefox 3.0.5 and Safari 3.2.1
ASP.NET 2.0 has introduced many new promising controls and TreeView is one among them. There has always been a requirement for Tree Control in earlier versions and it was quite hard to manage them with either the third party controls or the lighter version - IE Webcontrols.
Thanks to ASP.NET team, the 2.0 version rolled out with a built-in Treeview Control. The TreeView has many built-in features such as showing a checkbox for all the Tree Nodes. Node level formating, style, etc., Enabling the ShowCheckBoxes="All" property sets it to show a checkbox for all the nodes. The other options are Leaf, None, Parent and Root which show checkboxes at the respective node levels. None doesnt display CheckBoxes.
When we set ShowCheckBoxes="All", we would like to provide a feature where people can select the checkbox on the Root Node so that all the other checkboxes are checked automatically. Basically, when the parent node is checked, all the child nodes should be checked automatically.
It would be intuitive to accomplish this task at the client side without involving a postback.
The following code snippet helps in accomplishing the same.
TreeView Declaration
&asp:TreeView ID="TreeView1" Runat="server" DataSourceID="XmlDataSource1" onclick="client_OnTreeNodeChecked();" ShowCheckBoxes="all"&
&DataBindings&
&asp:TreeNodeBinding DataMember="Category" ValueField="ID" TextField="Name"&&/asp:TreeNodeBinding&
&asp:TreeNodeBinding DataMember="Description" ValueField="Value" TextField="Value"&&/asp:TreeNodeBinding&
&/DataBindings&
&/asp:TreeView&
In the above TreeView declaration Code, you can find the property onclick="client_OnTreeNodeChecked();" event which actually is the JavaScript function which would accomplish this task.
The Javascript Code snippet is as follows:-
&script language="javascript" type="text/javascript"&
function client_OnTreeNodeChecked()
var obj = window.event.srcE
var treeNodeFound =
var checkedS
if (obj.tagName == "INPUT" && obj.type == "checkbox") {
var treeNode =
checkedState = treeNode.
obj = obj.parentE
} while (obj.tagName != "TABLE")
var parentTreeLevel = obj.rows[0].cells.
var parentTreeNode = obj.rows[0].cells[0];
var tables = obj.parentElement.getElementsByTagName("TABLE");
var numTables = tables.length
if (numTables &= 1)
for (i=0; i & numT i++)
if (tables[i] == obj)
treeNodeFound =
if (i == numTables)
if (treeNodeFound == true)
var childTreeLevel = tables[i].rows[0].cells.
if (childTreeLevel & parentTreeLevel)
var cell = tables[i].rows[0].cells[childTreeLevel - 1];
var inputs = cell.getElementsByTagName("INPUT");
inputs[0].checked = checkedS
You may find that in Visual Studio 2005 the onclick method declared in the TreeView is underlined as an error, but still it would work.
This is a simple but sometimes frustrating requirement and hope this benefits similar requirements.
for posting the original idea.
A relevant article on
Cheers and Happy TreeViewing.
Email: (never displayed)
&(will show your )
Comment: Allowed tags: blockquote, a, strong, em, p, u, strike, super, sub, code
Verification:

我要回帖

更多关于 too many arguments 的文章

 

随机推荐