This question is locked. New answers and comments are not allowed.
Hi Team,
I am trying to bind a check box column in grid bound field using client template its not showing up.
Please help me.
Please check the code below.
I am loading the grid view data using the UserDetails model. I want to show two columns that first column would be a checkbox with username and second would be a usertype thaty is coming from membership database model.
Everything works fine I am able to see the data but not the checkbox column.
@model IEnumerable<Thinktecture.IdentityServer.Web.ViewModels.UserDetails>
@{
ViewBag.Title = "Administrator";
Layout = "~/Views/Shared/AdministratorLayout.cshtml";
}
@{ Html.Telerik().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(o => o.UserName)
.ClientTemplate("<input type='checkbox' name='checkedRecords' value='<#= UserName #>' />")
.Title("Select")
.Width(36)
.HtmlAttributes(new { style = "text-align:center" });
columns.Bound(o => o.UserName).Width(100);
columns.Bound(o => o.UserType).Width(100);
}).DataBinding(dataBinding => dataBinding.Ajax()
.Select("_CheckBoxesAjax", "Grid"))
.Scrollable()
.Pageable()
.Render();
}
<p>
<button class="t-button t-state-default" onclick="displayCheckedOrders()">Display checked orders</button>
<script type="text/javascript">
function displayCheckedOrders() {
var $checkedRecords = $(':checked');
if ($checkedRecords.length < 1) {
alert('Check a few grid rows first.');
return;
}
$('#result').load('@Url.Action("DisplayCheckedOrders", "Grid")', $checkedRecords);
}
</script>
</p>
<div id="result">
</div>
</p>
<div id="result">
</div>
I am trying to bind a check box column in grid bound field using client template its not showing up.
Please help me.
Please check the code below.
I am loading the grid view data using the UserDetails model. I want to show two columns that first column would be a checkbox with username and second would be a usertype thaty is coming from membership database model.
Everything works fine I am able to see the data but not the checkbox column.
@model IEnumerable<Thinktecture.IdentityServer.Web.ViewModels.UserDetails>
@{
ViewBag.Title = "Administrator";
Layout = "~/Views/Shared/AdministratorLayout.cshtml";
}
@{ Html.Telerik().Grid(Model)
.Name("Grid")
.Columns(columns =>
{
columns.Bound(o => o.UserName)
.ClientTemplate("<input type='checkbox' name='checkedRecords' value='<#= UserName #>' />")
.Title("Select")
.Width(36)
.HtmlAttributes(new { style = "text-align:center" });
columns.Bound(o => o.UserName).Width(100);
columns.Bound(o => o.UserType).Width(100);
}).DataBinding(dataBinding => dataBinding.Ajax()
.Select("_CheckBoxesAjax", "Grid"))
.Scrollable()
.Pageable()
.Render();
}
<p>
<button class="t-button t-state-default" onclick="displayCheckedOrders()">Display checked orders</button>
<script type="text/javascript">
function displayCheckedOrders() {
var $checkedRecords = $(':checked');
if ($checkedRecords.length < 1) {
alert('Check a few grid rows first.');
return;
}
$('#result').load('@Url.Action("DisplayCheckedOrders", "Grid")', $checkedRecords);
}
</script>
</p>
<div id="result">
</div>
</p>
<div id="result">
</div>