We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to add custom column with check box

Platform: ASP.NET Web Forms |
Control: Gantt |
Published Date: July 10, 2017 |
Last Revised Date: May 28, 2019

In Gantt, user can display checkbox column by using load client side event and column template support. The below code snippet explains initializing a custom column with checkbox and saving the editing changes to the data source.

Code snippets:

<form id="form1" runat="server" onsubmit="return false" style="overflow: hidden; padding:0; margin: 0;height:100%;width:100%;">
<ej:Gantt ID="Gantt" runat="server" AllowSelection="true" 
Load="Load" BeginEdit="BeginEdit">   


<script type="text/x-jsrender" id="customColumnTemplate">
<div style="margin-left:20px;">
{{if State}}
<input class="customCheckbox" type="checkbox" checked="checked" value="" />
<input class="customCheckbox" type="checkbox" value="" /> {{/if}}


function Load() {
var columns = this.getColumns();
columns.splice(4, 0,
field: "State",
headerText: "State",
isTemplateColumn: true,
templateID: "customColumnTemplate",
width: "80px",
// To prevent the string edit while editing check box
function BeginEdit(args) {
var columnIndex = args.columnIndex;
if (columnIndex == 4) {
args.cancel = true;
//Get checked row and select or unselect corresponding records
$("#Gantt").on("change", ".customCheckbox", function (e) {
var $tr = $(e.target).closest('tr'),
ganttObj = $("#Gantt").data("ejGantt"),
checkStatus = $(e.target).is(':checked'),
$gridRows = ganttObj.getRows(),
rowIndex = $gridRows.index($tr),
record = ganttObj.model.currentViewData &&    
record["state"] = checkStatus;

The following output is displayed for the above code example.

Add custom column with check box.Sample link

A sample to add custom column with check box is available in the following Sample link

2X faster development

The ultimate ASP.NET Web Forms UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon