且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Gridview中单击行时使表可见,主键传入表部分

更新时间:2023-11-24 13:05:22

参考我以前的解决方案关于在asp.net中选择行的gridview的火客户端事件 [ ^ ]。

而不是 visible =false,请执行 style =display:none;。因为当你设置Visible为false时,它不会在浏览器上呈现,所以你将无法在客户端做任何事情。



现在进入 JavaScript 函数,尝试删除 display:none

Refer my previous solution fire client side event for gridview on selection of row in asp.net[^].
Instead of doing visible="false", do style="display: none;". Because when you set Visible false, it don't render that on browser, so you won't be able to do anything to that in client side.

Now in that JavaScript function, try to remove the display: none.
function gridRowOnclick(element)
{
    alert("GridView clicked");
    var yourTable = document.getElementById("tbljobAction");
    yourTable.style.display = yourTable.style.display === 'none' ? '' : 'none';
}