使用javascript 如何动态隐藏和显示 GridView列
解决方案 »
- 用过xheditor的进,如何在前台给xheditor的textarea赋值
- .NET MVC 中如何获取当前方案中所有的Controller以及每个Controller中的Action呢?
- 請教:Ext RowEditor問題
- 删除文件
- 弱弱的问一下SqlDataAdapter.Fill的时候会隐式打开关闭连接?
- 使用castle的ActiveRecord,除了单表的操作好用外,我要关联查询啊,执行存储过程啊,怎么办?难道用两套数据访问
- 有一点不明白,关于DataSet
- DropDownList特急急。。。。汗!!!
- 为什么tree控件老是出错呢???
- textbox mutiline 时,如何控制文本内容长度?(刚刚发完分,没有了,帮忙)
- 想改变DIV的scrollHeight的值
- asp.net treeview
function HideCol(gridView, colIndex, colName) {
var rows = document.getElementById(gridView).rows;
for(i = 0; i < rows.length; i++)
if(rows[i].id != gridView + "_pager")
rows[i].cells[colIndex].style.display = "none";
// Add the name and index of the hidden column to the dropdown list
var hiddenCols = document.getElementById(gridView + "_showCols");
hiddenCols.options[hiddenCols.length] = new Option(colName, colIndex);
SetupHiddenCols(gridView);
}// Show each cell in a gridview column
function ShowCol(gridView, colIndex) {
var rows = document.getElementById(gridView).rows;
for(i = 0; i < rows.length; i++)
if(rows[i].id != gridView + "_pager")
rows[i].cells[colIndex].style.display = "";
// Remove the name and index of the hidden column from the dropdown list
var hiddenCols = document.getElementById(gridView + "_showCols");
for(i = 0; i < hiddenCols.options.length; i++)
if(hiddenCols.options[i].value == colIndex)
hiddenCols.options[i] = null;
SetupHiddenCols(gridView);
}// Setup the drop down list to show the hidden columns
function SetupHiddenCols(gridView) {
var hiddenCols = document.getElementById(gridView + "_showCols");
if(hiddenCols)
if(hiddenCols.options.length > 1)
hiddenCols.style.display = "";
else
hiddenCols.style.display = "none";
}