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

Cell type as RadioButton: Please do reply

HI, I am trying to understand the radioButtonCell sample. Q#1 Can I have all the cells of a column as radio button type? Q#2 Using what property or where do we specify the number of radio buttons for a cell, because a cell my hold any number of different vales? When I run the sample it is working for first two cells in 2nd column. But when I set the cell type as ‘radiobutton’ for some other cell it doesn’t show up. Please do help. I would really appreciate if you could reply soon. Thanks

3 Replies

AD Administrator Syncfusion Team April 12, 2005 05:01 PM

>HI, > >I am trying to understand the radioButtonCell sample. > >Q#1 >Can I have all the cells of a column as radio button type? > Set the column style (in grid.ColStyles) to have a CellType = "RadioButton". Unless all columns have the same radio buttons, you''ll need to set a different ChoiceList for each one. CellValue sets which radio button is currently checked. >Q#2 >Using what property or where do we specify the number of radio buttons for a cell, because a cell my hold any number of different vales? > The ChoiceList member of the Style contains the list of radio buttons as per the RadioButton sample in MainForm.cs around lines 67-72. >When I run the sample it is working for first two cells in 2nd column. But when I set the cell type as ‘radiobutton’ for some other cell it doesn’t show up. > Can you provide sample code that isn''t working? I''ve had no problem setting any cell to contain radio buttons. Pete


AN Anu April 12, 2005 06:42 PM

Thanks Pete, >Can you provide sample code that isn''t working? >I''ve had no problem setting any cell to contain >radio buttons. When you run that sample and pick any cell try to set the cell type at the run time within sample itself. it doesn’t show the radiobuttos. Probably because there is no way you can define ChoiceList at the run time that is why i don''t see. I may be wrong. thanks & regrads > > >>HI, >> >>I am trying to understand the radioButtonCell sample. >> >>Q#1 >>Can I have all the cells of a column as radio button type? >> > >Set the column style (in grid.ColStyles) to have a CellType = "RadioButton". Unless all columns have the same radio buttons, you''ll need to set a different ChoiceList for each one. CellValue sets which radio button is currently checked. > > >>Q#2 >>Using what property or where do we specify the number of radio buttons for a cell, because a cell my hold any number of different vales? >> > >The ChoiceList member of the Style contains the list of radio buttons as per the RadioButton sample in MainForm.cs around lines 67-72. > >>When I run the sample it is working for first two cells in 2nd column. But when I set the cell type as ‘radiobutton’ for some other cell it doesn’t show up. >> > >Can you provide sample code that isn''t working? I''ve had no problem setting any cell to contain radio buttons. > >Pete


AD Administrator Syncfusion Team April 12, 2005 08:22 PM

You can set the ChoiceList at runtime in that sample.
private void Form1_Load(object sender, System.EventArgs e)
{
	this.gridControl1[1,1].CellType = "RadioButton";
	StringCollection sc = new StringCollection();
	sc.AddRange(new string[]{"one", "two"});
	this.gridControl1[1,1].ChoiceList = sc;
}


In a GridDataBoundGrid, you cannot set any single cell style properties (except CellValue/Text). Instead, you woul dhandle grid.Model.QueryCellInfo, and if e.RowIndex and e.COlIndex point to your cell, then set e.Style.ChoiceList to the list you want to see in the radionButton cell, and set e.Style.CelType="RadioButton".


            

Loader.
Live Chat Icon For mobile
Up arrow icon