Your code is as follows:
http://jsfiddle.net/Archie/w6jsZ/
<div style="width:250px;height:350px;overflow-y:scroll;">
<div>
<input type="checkbox" id="checkall" class="click" />
<span class="checkbox">All</span>
</div>
<div id="listView" class="k-listview" >
</div>
</div>
<script type="text/x-kendo-tmpl" id="myTemplate">
<div class="item click" data="${ProductID}">
<input type="checkbox" class="click" />
<span class="checkbox">#:ProductName#</span>
</div>
</script>
$(document).ready(function () {
function checkboxEventBinding()
{
$('#checkall').bind('click',function(e){
if(this.checked)
{
$('.item.click input').attr('checked','checked');
}
else
{
$('.item.click input').removeAttr('checked');
}
})
}
var dataSource = new kendo.data.DataSource({
transport: {
read: {
url: "http://demos.kendoui.com/service/Products",
dataType: "jsonp"
}
}
});
$("#listView").kendoListView({
dataSource: dataSource,
template: kendo.template($("#myTemplate").html()),
headertemplate:"<div class='item click' id='headerTemp' data='*'> <input type='checkbox' class='click' /><span class='checkbox'>All</span></div>",
dataBound: function(e) {
checkboxEventBinding();
}
});
});
- Check the box (to check all) in front of the kendo list template
- Check-all, .
- .
//UPDATE
:
, "form"
<form id="frmChk">
<div id="listView" class="k-listview" >
</div>
</form>
input same name
<script type="text/x-kendo-tmpl" id="myTemplate">
<div class="item click" data="${ProductID}">
<input type="checkbox" name="chkValue" value="${ProductID}" class="click" />
<span class="checkbox">#:ProductName#</span>
</div>
</script>
Go , jeryery serialize:
<script>
function getCheckedBoxValue()
{
$("#frmChk").serialize();
}
</script>
:
<input type="checkbox" name="chkValue" value="Ikura1" class="click" />
<input type="checkbox" name="chkValue" value="Ikura2" class="click" />
<input type="checkbox" name="chkValue" value="Ikura3" class="click" />
getCheckedBoxValue, :
chkValue=Ikura1,Ikura2,Ikura3