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
HA
haneefm
Syncfusion Team
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
TH
Thanvir Hussain
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
HA
haneefm
Syncfusion Team
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