Category / Section
How to customize a cell in ASP.NET Web Forms Treegrid?
1 min read
In TreeGrid, the customization of grid cells can be done by using QueryCellInfo client-side event. This event is triggered at load time of the control. You will get cell values, cell element, columns and the record value in the function argument. With those information, we can customize that cell at load time. The below code snippet explains how to highlight a cell of a duration field.
ASPX
<ej:TreeGrid ID="TreeGrid" runat="server” QueryCellInfo="queryCellInfo”> </ej:TreeGrid> <script type="text/javascript"> function queryCellInfo(args) { if (args.column.field == " duration ") { var cellValue = args.data.item.duration; if (cellValue < 10000 || 0) args.cellElement.bgColor = "#FA7F7F"; } } </script> [ASPX.CS] protected void Page_Load(object sender, EventArgs e) { TaskDetailsCollection TaskCollection = new TaskDetailsCollection(); this.TreeGrid.DataSource = TaskCollection.GetDataSource(); this.TreeGrid.DataBind(); }
A sample with customized drag icons is available in the following link,