在gridview外部单击时取消选择gridview行。 [英] unselect gridview row when clicked on outside of gridview.
问题描述
我有一些带有一些数据的gridview。我有一个小要求,如果我点击gridview的任何一行,那么如果我点击gridview外面它会选择和取消选择所选行。我做了除了如何做的一切如果我点击gridview外面的话,取消选择gridview行。请建议我...
I have a gridview with some data.I have a small requirement that if I will click on any row of the gridview then it will select and unselect the selected row if I will click outside of the gridview.I did everything except how to unselect the gridview row if I will click on outside of the gridview.Please suggest me...
推荐答案
你可以尝试使用:
You can try using :
MyGridView1.SelectedIndex = -1;
但这是服务器端代码。你需要在JavaScript页面点击事件中触发它(使用 __doPostBack(''target'',''args'')
)。另请检查:如何使用__doPostBack功能 [ ^ ]。
--Amit
But this is a server side code. You need to fire this on JavaScript page click event(Use __doPostBack( ''target'', ''args'')
). Also check : How to use __doPostBack function[^].
--Amit
这篇关于在gridview外部单击时取消选择gridview行。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!