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.
Unfortunately, activation email could not send to your email. Please try again.

How to make a DropdownGrid CellType cell editable and force a CheckBox cell update cellValue after click?

Thread ID:

Created:

Updated:

Platform:

Replies:

61101 May 17,2007 04:28 PM May 18,2007 09:37 AM Windows Forms 5
loading
Tags: GridControl
Dongxian Li
Asked On May 17, 2007 04:28 PM

Hi,
We are using Syncfusion V4.4.0.51 Windows Forms Grid Control. I have a regular gridControl that have 10 rows and 2 columns. There are two issues with the gridControl:
(1). I have some cells whose cell type is set to DropdownGrid CellType. The problem is once the cell is set to this type, it is not directly editable like a ComboBox cell. Is there a way to make DropdownGrid cell still editable?
(2). I have some cells whose cell type is set to CheckBox CellType. Once it is clicked, the checkbox changes status right away and the CheckBoxClick event is fired. But the CellValue of the checkbox is still the old value when checked in the CheckBox Event handler. Actually the CellValue is not changed until you click on another cell. How can I force the CellValue change to the new value without clicking on somewhere else?

Thanks
Dongxian

haneefm [Syncfusion]
Replied On May 17, 2007 05:34 PM

Hi Dongxian,

Regarding Question 1:
>>>>>>>>>>>>>>>>>>

You can try setting the SupportFocusControl property of the DropDownGridCellRenderer to true in DropDownGridCellRenderer constructor. Below is a code snippet

public class DropDownGridCellRenderer: GridDropDownGridCellRenderer
{
GridControlBase grid;

public DropDownGridCellRenderer(GridControlBase grid, GridCellModelBase cellModel)
: base(grid, cellModel)
{
this.SupportsFocusControl = true;
DropDownButton = new GridCellComboBoxButton(this);
this.grid = null;
}

//////////// YOUR CODE /////////////
}

Regarding Question 2:
>>>>>>>>>>>>>>>>>>

The reason is that you are not setting the checkboxoptions property in a cell. Here is a KB article that discuss with purpose of CheckBoxOptions in a grid's cell.
http://www.syncfusion.com/support/kb/grid/Default.aspx?ToDo=view&questId=28

Best regards,
Haneef

Best regards,
Haneef

haneefm [Syncfusion]
Replied On May 17, 2007 10:56 PM

Hi Dongxian,

The CheckBoxClick is the event that gets triggered only when user clicks using the mouse on the checker box of checkbox. You can catch the CurrentCellChanged event for detecting any changes made to the checkbox cell.

void grid_CurrentCellChanged(object sender, EventArgs e)
{
GridCurrentCell cc = this.grid.CurrentCell;
if (cc.Renderer.StyleInfo.CellType == "CheckBox")
{
Console.WriteLine("CheckBox cell({0},{1})=> {2}", cc.RowIndex, cc.ColIndex, this.grid.Model[cc.RowIndex,cc.ColIndex].CellValue);
}
}

Best regards,
Haneef

haneefm [Syncfusion]
Replied On May 17, 2007 10:57 PM

Hi Dongxian,

The CheckBoxClick is the event that gets triggered only when user clicks using the mouse on the checker box of checkbox. You can catch the CurrentCellChanged event for detecting any changes made to the checkbox cell.

void grid_CurrentCellChanged(object sender, EventArgs e)
{
GridCurrentCell cc = this.grid.CurrentCell;
if (cc.Renderer.StyleInfo.CellType == "CheckBox")
{
Console.WriteLine("CheckBox cell({0},{1})=> {2}", cc.RowIndex, cc.ColIndex, this.grid.Model[cc.RowIndex,cc.ColIndex].CellValue);
}
}

Best regards,
Haneef

Dongxian Li
Replied On May 18, 2007 01:43 AM

Haneef,
Thank you.
That works.

Dongxian

Dongxian Li
Replied On May 18, 2007 09:37 AM

Hi Haneef,
Thank you for your support.
Your answer to question 1 solved my problem.
That is great. Thanks.

As for Question 2, I am actually using the example code that comes with the Syncfusion software (CellControlsGrid_2005.sln). The CheckBoxOption is set properly. When the checkbox is clicked, the cellValue toggles properly eventually. The only problem is that it returns the old cellValue in the CheckBoxClick event handler. Following is my code for getting the text:

private void gridControl1_CheckBoxClick(object sender, GridCellClickEventArgs e)
{

int row = e.RowIndex;
int col = e.ColIndex;

//the text returned is the old value before click. I hope to get the new value somewhere.
string text = gridControl1[row, col].Text;

}

You can use the example solution to reproduce the problem. My question is where can I get the new value after I clicked the checkbox but without clicking on anywhere else?

Thanks
Dongxian

CONFIRMATION

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.

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.

;