[webgrid] – header - (How to Add custom html to Header in WebGrid)
How to Add custom html to Header in WebGrid
Posted on March 30, 2013by mtryambake
How to make a MVC 3 Webgrid with checkbox column?
This article will show you a How to Add custom html to Header in WebGrid e.g. add a check box in webgrid header.
Some time you come across a situation where you have to add html element (checkbox) in webgrid header, consider a column with checkbox and you want to add checkbox in the header of same column.
Approach: In document.ready event find out webgrid header and replace it with html string.
$(document).ready(function () {
$('#gridContent table th').each(function () {
if (this.innerHTML == "") {
this.innerHTML = "<input type='checkbox' id='chkHeader' />";
}
});
});
Application: If you have a checkbox column in webgrid and on clicking of header checkbox all checkbox in column will be checked.
<script type="text/javascript">
$(document).ready(function () {
$('#gridContent table th').each(function () {
if (this.innerHTML == "") {
this.innerHTML = "<input type='checkbox' id='chkHeader' />";
}
});
$('#gridContent table th input:checkbox').click(function (e) {
var table = $(e.target).closest('table');
$('td input:checkbox', table).attr('checked', e.target.checked);
});
}); </script>
========================================================================================================
for reference
========================================================================================================
$(function () {
$('.gridTable thead tr th:first').html(
$('<input/>', {
type: 'checkbox',
click: function () {
var checkboxes = $(this).closest('table').find('tbody tr td input[type="checkbox"]');
checkboxes.prop('checked', $(this).is(':checked'));
}
})
);
});
[webgrid] – header - (How to Add custom html to Header in WebGrid)的更多相关文章
- Add custom and listview web part to a page in wiki page using powershell
As we know, Adding list view web part is different from custom web part using powershell, what's mor ...
- How To Add Custom Build Steps and Commands To setup.py
转自:https://jichu4n.com/posts/how-to-add-custom-build-steps-and-commands-to-setuppy/ A setup.py scrip ...
- Add custom daemon on Linux System
Ubuntu add custom service(daemon) Task 需要在系统启动的时候自动启动一个服务(后台程序),在系统关闭的时候关闭服务. 比如在部署某个应用之前,需要将某个任务设置成 ...
- RestTemplate发送请求并携带header信息 RestTemplate post json格式带header信息
原文地址: http://www.cnblogs.com/hujunzheng/p/6018505.html RestTemplate发送请求并携带header信息 v1.使用restTempl ...
- Add custom field in Material Master
1.Add fields in the Append Structure of table MARA. 2.Configure SPRO IMG -> Logistics General -&g ...
- grafana add custom dashboard
grafana-dashboard-json prometheus-operator helm 中的grafana dashboard 扩展的时候,需要转换下载(https://grafana.com ...
- [webgrid] – selecterow - (Get Selected Row from ASP.NET MVC 3 WebGrid)
Get Selected Row from ASP.NET MVC 3 WebGrid Abstract: The following article demonstrates how to get ...
- Umbrella Header for Module Bolts does not include header 'XXXXXX.h'?
在我们引入第三方Framwork时.有时会出现如标题的警告提示? 怎样解决? Framework 将在下面文件夹下创建一个Module/,并创建一个module.modulemap文件 waterma ...
- 开发Angular库的简单指导(译)
1. 最近工作上用到Angular,需要查阅一些英文资料,虽然英文非常烂,但是种种原因又不得不硬着头皮上,只是每次看英文都很费力,因此决定将一些比较重要的特别是需要反复阅读的资料翻译一下,以节约再次阅 ...
随机推荐
- java-原生爬虫机制源码
这是一个web搜索的基本程序,从命令行输入搜索条件(起始的URL.处理url的最大数.要搜索的字符串),它就会逐个对Internet上的URL进行实时搜索,查找并输出匹配搜索条件的页面. 这个程序的原 ...
- 回到顶端js实现
function goTop(){ var _btn = document.getElementById("goTop"); if (document.documentElemen ...
- 怎么给我的Office文档加密
很多的用户朋友都可以熟练的使用office中的Word.Excel和PowerPoint文档,但大家对Office文档加密方式了解的并不多.Advanced Office Password Recov ...
- 【POJ 2528】Mayor’s posters(线段树+离散化)
题目 给定每张海报的覆盖区间,按顺序覆盖后,最后有几张海报没有被其他海报完全覆盖.离散化处理完区间端点,排序后再给相差大于1的相邻端点之间再加一个点,再排序.线段树,tree[i]表示节点i对应区间是 ...
- 【转】wait,notify,notifyAll,join,yield,sleep的区别和联系
1. Thread.sleep(long) 和Thread.yield()都是Thread类的静态方法,在调用的时候都是Thread.sleep(long)/Thread.yield()的方式进行调 ...
- bbs树形打印(一)
前言:大家在bbs回帖时常常可以看到树形的回复形式. dfs设计 (1) 为使得Connection仅打开一次,因此以conn作为其中一个递归参数,在递归全程不关闭conn; (2)根据存入数据的树状 ...
- python编程关键字
1.常见关键字 (带有操作含义的关键字) for:循环 in:成员比较运算符 if :如果分支 elif:如果分支 else:其他分支 while:循环 def:定义函数 class:定义类 glob ...
- [日常训练]常州集训day7
T1 Description 给定一个序列,初始为空.依次将$1-n$插入序列,其中$i$插到当前第$a_i$个数的右边($a_i=0$表示插到序列最左边).求最终序列. Input 第一行一个整数$ ...
- Leetcode Odd Even Linked List
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note her ...
- Input path does not exist: file:/.......
注意看是file不存在并不是hdfs,好奇怪,突然明白应该是路径不对,必须加上hdfs://hostname:port/file. 我为什么饭这样的错误是因为前一阵谢了HDFS的曹组,谢了全局File ...