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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

CheckBoxClick event or CurrentCellChanged event

Thread ID:





143586 Aug 30,2005 02:39 PM UTC Mar 28,2019 11:11 AM UTC Angular - EJ 2 7
Tags: Grid
Najmeh Joze-khajavi
Asked On August 30, 2005 02:39 PM UTC

Here is the scenario and I am not sure which event (CheckBoxClick or CurrentCellChanged) is the right one to use. I have a grid control that has two check boxes. These check boxes suppose to do totally different things. When click in one of them it suppose to display two hidden columns and the other one suppose to change some coloring. CheckBoxClick event is for grid therefore I need to know which checkbox has changed to do the proper action. I thought of CurrentCell.RowIndex and CurrentCell.ColIndex. But for first time when I click on the checkbox the RowIndex and ColIndex returns -1, -1. The second time it returns the correct position. How can I fix this? Should I use CurrentCellChanged instead?

Administrator [Syncfusion]
Replied On August 30, 2005 03:21 PM UTC

What kind of grid are you using? Why can you not use gridControl1.CheckBoxClick or gridGroupingControl1.TableControlCheckBoxClick or gridDataBoundGrid1.CheckBoxClick?

Najmeh Joze-khajavi
Replied On August 30, 2005 05:08 PM UTC

I am using GridControl. When I said CheckBoxClick event I meant the same as gridControl1.CheckBoxClick. Since I have two check boxes I need to know which checkbox has been checked by user. Therefore I need to know the row and column of the checkbox. I found out how I can get the row and column. I used e.RowIndex and e.ColIndex. private void _WorksheetGrid_CheckBoxClick(object sender, GridCellClickEventArgs e) { GridStyleInfo style; GridControl grid = sender as GridControl; if (grid != null) { if (e.RowIndex == 1 && e.ColIndex ==5 ) //Show Prefault { .... } if (e.RowIndex == 14 && e.ColIndex == 11 ) { ... } ... }

Replied On November 29, 2005 09:57 PM UTC

Actually, Clay, Najmeh''s question raises an important question - is there something broken about the CurrentCellChanged event w/r/t checkboxes?? Inside that event, I am seeing what seems to be inconsistent behavior. If the cell firing the event is a textbox, grid.CurrentCell().GetRenderer().GetCellValue() returns the correct "new value" in the text box. If, however, the cell that changed is a checkbox, GetRenderer().GetCellValue() ~always~ returns true. Could this be correct?

Administrator [Syncfusion]
Replied On November 30, 2005 12:45 AM UTC

This is actually by design. The CheckBox CellType is special. It has no active cell control and the checkbox is drawn in a static manner. There is no Control used to render this cell. The values are immediately stored in the grid as they are changed. Here is code that shows how to get this current value in CurrentCellChanged.
private void gridControl1_CurrentCellChanged(object sender, EventArgs e)
	GridCurrentCell cc = this.gridControl1.CurrentCell;
	if(this.gridControl1[cc.RowIndex, cc.ColIndex].CellType == "CheckBox")
		Console.WriteLine(this.gridControl1[cc.RowIndex, cc.ColIndex].CellValue);

Replied On November 30, 2005 11:11 PM UTC

Clay, Thanks for confirming this behavior is by design. I had already figured out to use grid[r,c].cellvalue - but I wasn''t sure this was by intent, or just a convenient hack. -ralph

Replied On March 27, 2019 07:26 PM UTC


Is possible the use of currentcell in asp.net?
I can't use this element.

Cordially, Guadalupe Baigorria

Vignesh Natarajan [Syncfusion]
Replied On March 28, 2019 11:11 AM UTC

Hi Guadalupe, 
Thanks for using Syncfusion products. 
From your query, we are able to understand that you want to find the row and cell information in the server side when the checkbox cell is clicked in the grid. To achieve your requirement we suggest you to use the OnServerRecordClick event. 
Refer the below code example, 
<asp:UpdatePanel runat="server"> 
            <script id="template" type="text/template"> 
                <input type="checkbox" id="Verified{{:EmployeeID}}" name="Verified" onchange="myFunction(event)"  class="e-field e-checkbox" style="width: 30px" /> 
            <ej:Grid ID="EmployeesGrid" runat="server" AllowPaging="True" OnServerRecordClick="EmployeesGrid_ServerRecordClick"> 
                <PageSettings PageSize="4"></PageSettings> 
                <ClientSideEvents ActionComplete="Complete" /> 
                    <ej:Column HeaderText="checkbox" Template="#template" TextAlign="Center" Width="110" /> 
     var id, state; 
                function myFunction(event) { 
                    id = $(event.target).attr("id"); 
                    state = $(event.target).prop("checked"); 
                function Complete(args) { 
                    setTimeout(function () { 
                         $("#" + id).prop("checked", state); 
    protected void EmployeesGrid_ServerRecordClick(object sender, GridEventArgs e) 
            // do your stuff here. 
If we misunderstood, your requirement please get back to us with the following details. 
  1. Share the complete grid code example you are using.
  2. Share your requirement in detail.
Vignesh Natarajan. 


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

Live Chat Icon For mobile
Live Chat Icon