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

Custom RadioButton cell Render

Thread ID:

Created:

Updated:

Platform:

Replies:

63731 Jul 9,2007 11:22 AM UTC Jul 10,2007 03:55 PM UTC WinForms 3
loading
Tags: GridControl
Thanvir Hussain
Asked On July 9, 2007 11:22 AM UTC

Hi,

Can you please let me know how to initialize the choicelist inside a customer GridRadioButtonCellRenderer class. I am trying to build a custom radiobuttoncell with specific choice list, which can be used accross grids.
many thanks
thanvir

haneefm [Syncfusion]
Replied On July 9, 2007 06:49 PM UTC

Hi Thanvir,

With the RadioButton CellType you can have a number of radiobuttons in a cell which, will behave as grouped.

this.gridControl1[2, 2].CellType = "RadioButton";

The number of radiobuttons that are needed is set to an instance of the StringCollection and are added through the ChoiceList property of that particular cell.

sc = new StringCollection();
sc.AddRange(new String[]{"radio 0/disabled","radio 1"});
this.gridControl1[2, 2].ChoiceList = sc;

Describing disabled after a forward slash disables the radiobutton. Setting the CellValue of the radiobutton cell to the index of the StringCollection will enable the particular button as checked.

this.gridControl1[2, 2].CellValue = 0;//selected button As a keyboard option with left/right arrow keys, the required button can be selected.

Best regards,
Haneef

Thanvir Hussain
Replied On July 10, 2007 07:38 AM UTC

Hi Haneef,
I am able to get it working when I set the stringcollection to the choicelist through the Grid. But what I wanted was to set the choice list inside a customrenderer class, So that once I create this cellmodel, it can use it accross the grids.
I would like something where I can set the choicelist inside the constructor of the custome cellrenderer class but setting in the consturctor does not seems to work.

thanvir

>Hi Thanvir,

With the RadioButton CellType you can have a number of radiobuttons in a cell which, will behave as grouped.

this.gridControl1[2, 2].CellType = "RadioButton";

The number of radiobuttons that are needed is set to an instance of the StringCollection and are added through the ChoiceList property of that particular cell.

sc = new StringCollection();
sc.AddRange(new String[]{"radio 0/disabled","radio 1"});
this.gridControl1[2, 2].ChoiceList = sc;

Describing disabled after a forward slash disables the radiobutton. Setting the CellValue of the radiobutton cell to the index of the StringCollection will enable the particular button as checked.

this.gridControl1[2, 2].CellValue = 0;//selected button As a keyboard option with left/right arrow keys, the required button can be selected.

Best regards,
Haneef

haneefm [Syncfusion]
Replied On July 10, 2007 03:55 PM UTC

Hi Thanvir,

In your custom cell renderer, you can subscribe the QueryCellInfo event and set the ChoiceList of the cell using this event. Below are the code snippet

sc = new StringCollection();
sc.AddRange(new String[]{"radio 0/disabled","radio 1"});
this.Grid.Model.QueryCellInfo += new GridQueryCellInfoEventHandler(HandleQueryCellInfo);

//the handler
private void HandleQueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
e.Style.ChoiceList = sc;
}

Best regards,
Haneef

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.

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

;