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

input checbox in grid

Thread ID:





90441 Oct 1,2009 12:04 PM UTC Oct 8,2009 05:06 AM UTC ASP.NET MVC (Classic) 3
Tags: Grid
Pawel Szpytma
Asked On October 1, 2009 12:04 PM UTC


I would like to add a column with an input type "checkbox" to the MVC grid. Is this possible?

THX in advance.

Balaji M [Syncfusion]
Replied On October 1, 2009 10:51 PM UTC

Hi Pawel,

Thank you for your interest in Syncfusion products.

We suggest you to use the Format option inside QuerycellInfo, in order to achieve this Checkbox inside Grid.

Please refer the following code snippet to achieve this.

public ActionResult Index()

GridPropertiesModel model = new GridPropertiesModel
Caption="Student List",
ViewData["GridModel"] = model;
model.QueryCellInfo += new GridTableCellStyleInfoEventHandler(model_QueryCellInfo);

return View();

void model_QueryCellInfo(object sender, GridTableCellStyleInfoEventArgs e)
if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)
if (e.TableCellIdentity.Column.MappingName == "Result")
if ((bool)e.Style.CellValue)
e.Style.Format = "";
e.Style.Format = "";

e.Handled = true;

Please refer the sample from the below link.


The Sample illustrates,

1. Result is column contains the boolean value.

2. Inside QueryCellInfo event, Result column in the grid formatted using style.Format property.

Please let me know if you have any concerns.

M. Balaji

Pawel Szpytma
Replied On October 7, 2009 02:16 PM UTC

I used the code recommended by you, but i'm having problems with sorting. When I sort the column, it changes from input type to normal text,

THX in advance.

Balaji M [Syncfusion]
Replied On October 8, 2009 05:06 AM UTC

Hi Pawel,

Thank you for your interest in Syncfusion product.

This is default behaviour of MVC Grid. We suggest you to bind QueryCellInfo event in ActionResult,in order to get the format at all pages.

Refer the below code snippet, which illustrates this.

public ActionResult SortingAction(PagingParams args)
GridHtmlActionResult result = new GridHtmlActionResult();
result.GridModel.DataSource = context.Students.Skip(0).Take(10);
result.GridModel.QueryCellInfo += new GridTableCellStyleInfoEventHandler(model_QueryCellInfo);
return result;

Please refer the updated sample from the below link.

Please let me know if you have any concerns.

M. Balaji.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

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

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