Articles in this section

How to customize a cell in Treegrid in ASP.NET MVC ?

TfeatuVC In ASP.NET MVC 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. User 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.

 

MVC

@(Html.EJ().TreeGrid("TreeGridContainer")      
// ...                    
.ClientSideEvents(eve =>
{ 
eve.QueryCellInfo("queryCellInfo");
})
.Datasource(ViewBag.datasource)                                             
// ...
)   
function queryCellInfo(args) {
if (args.column.field == "Duration") {
var cellValue = args.data.item.Duration;
if (cellValue < 5)
args.cellElement.bgColor = "#FA7F7F";
}
}
 

 

Highlight the cell of duration field based on condition In ASP.NET MVC TreeGrid

A sample with customized cell with condition is available in the following link,

Sample

 

 

Conclusion

I hope you enjoyed learning about how to customize a cell in Treegrid in ASP.NET MVC.

You can refer to our ASP.NET MVC TreeGrid  feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our .NET MVC TreeGrid example to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied