后台调用JS文件 c#
2007-07-17 16:49
344 查看
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
//第一步:写下面的js文件。
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
//第二步,给铵钮添加属性(btnDeleteCol.Attributes.Add("onclick", "return judgeChkCol();");)。
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
//第三步,写铵钮的后台代码。
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
<script>
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
function judgeChk()
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
var count = 0;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
//注意:如果GridView没有分页,则document.all.gvTable.rows.length-1
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
// 否则[有分页]document.all.gvTable.rows.length-2 (分页标记占用了一行)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
for(var i=0; i < document.all.gvTable.rows.length-2; i++ )
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(i < 8)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(document.all("gvTable_ctl0"+eval(i + 2)+"_chkTable").checked)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
count += 1;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(document.all("gvTable_ctl"+eval(i + 2)+"_chkTable").checked)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
count += 1;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(count == 0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
alert("请选择您要删除的项!");
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(count != 0)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockStart.gif)
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ContractedSubBlock.gif)
...{
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
if(confirm("您确定删除 "+count+" 项吗?"))
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return true;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
else
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/InBlock.gif)
return false;
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedSubBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/ExpandedBlockEnd.gif)
}
![](http://images.csdn.net/syntaxhighlighting/OutliningIndicators/None.gif)
</script>
相关文章推荐
- [转]前台js与后台C#互相调用
- c#后台调用前台与js方法互调
- C#后台调用JS
- 前台js与后台C#互相调用
- resumable.js —— 基于 HTML 5 File API 的文件上传组件 支持续传后台c#实现
- C#winform后台代码与HTML内JS脚本函数相互调用
- 如何在前台JS调用后台C#方法
- C# js调用后台方法
- asp.net中前台js变量与后台c#的相互调用方法
- 【WebForm】Js调用后台C#方法
- js 调用C#.NET后台方法 【收藏】
- C#前台js调用后台代码和后台代码调用前台js
- 不用AJAX实现前台JS调用后台C#方法(小技巧) 【改自Web.网际浪人.Blog】
- 不用AJAX实现前台JS调用后台C#方法(小技巧)
- 前台JS调用后台C#方法(转)
- 不用AJAX实现前台JS调用后台C#方法
- C#后台调用前台页面js方法
- 不用AJAX实现前台JS调用后台C#方法(小技巧)
- 前台js与后台C#互相调用
- C#前台js调用后台代码