问题描述
我已经延长在GridView使其可点击(即当过我们点击它选中的任何行,详细视图根据所选的行显示)。
I have extended the Gridview making it Clickable (i.e. when ever we click on any row it is selected and a detail view is shown according to the row selected).
然后我加选择/在使用JavaScript的帮助,GridView中取消选择所有复选框。现在的问题是,该网页正在postbacked每次我点击复选框。我不想这样,我不想回发发生,如果这个特定的列元素即复选框pressed。
I then added Selecting / Deselecting all the CheckBoxes in that GridView with the help of javascript. The problem now is that the page is being postbacked every time i click checkbox. I don't want this i don't want postback to happen if this particular column element i.e checkbox is pressed.
有什么办法,我可以知道哪个列时发生的回传被选中时,这样我可以知道它正在发生的事情形成有复选框列。
Is there any way that i can know which of the column is being selected when when the postback happens so that i can know it is happening form the column having checkbox.
请让我知道如果你有soultion吧。
Please let me know if you have soultion to it.
谢谢,
推荐答案
我发现我的问题的解决方案是如下:
I found the solution for my problem which is as follow:
我们不得不取消从事件冒泡的复选框,这样它不会冒泡到GridView RowClicked事件。
We have to cancel the Event Bubbling from Checkbox so that it won't bubble up to the Gridview RowClicked event.
取消事件冒泡形式的复选框的方法是如下:
The way of canceling the event bubbling form checkbox is as follow:
cb.Attributes(onclick事件)=event.cancelBubble = TRUE;
cb.Attributes("onclick") = "event.cancelBubble=true;"
,其中CB是复选框。
希望这将帮助有同样的问题,其他像我一样,
Hope this will help others having same problem as i did,
谢谢,
这篇关于ASP.NET的GridView:我们如何能找到在GridView中选择哪一列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!