Radiobutton in grid

I have radiobutton as one of the cells in the grid. But I have alignment problems. Please look at the attached image. I want to bring the two options closer. Is there a way to achieve it?

Thanks in advance!




radiobutton_133bb3f0.zip

6 Replies

VT Vivek Thirumalai October 1, 2009 11:05 PM UTC

Also is there a way to specify the value of the radiobutton options?


LS Lingaraj S Syncfusion Team October 2, 2009 01:50 PM UTC

Hi Vivek,

Thank you for your interest in Syncfusion products.

Please try overriding the OnLayout method in CustomRadioCellRenderer to reduce the distance between RadioButtons as shown in below sample:
http://files.syncfusion.com/support/samples/Grid.Windows/7.3.0.20/Forums/Radio.zip

Please let me know if you have any queries.

Regards,
Lingaraj S.


VT Vivek Thirumalai October 5, 2009 10:53 PM UTC

Hi Lingaraj,

Thanks for the example. About my second question, if the choicelist is :

sc.AddRange(new String[]{ "radio 0", "radio 1"});

when radio 0 is selected the value is 0, but can the value be different. Basically I want this to be other way, meaning my I want to display radio 1 before radio 0:

sc.AddRange(new String[]{ "radio 1", "radio 0"});

and I want the value to be the same i.e., when radio 1 is selected the value needs to be 1. Is this possible? I can do it programmatically, but want to see if this doable via choicelist.

Thanks.


JJ Jisha Joy Syncfusion Team October 6, 2009 11:47 AM UTC

Hi Vivek,

You could try handling the CellButtonClicked event and let me know if this helps.

void gridControl1_CellButtonClicked(object sender, GridCellButtonClickedEventArgs e)
{
GridCurrentCell cc = this.gridControl1.CurrentCell;

if (this.gridControl1[cc.RowIndex, cc.ColIndex].CellValue.Equals(0))
{
this.gridControl1[cc.RowIndex, cc.ColIndex].CellValue = 1;
}
else if (this.gridControl1[cc.RowIndex, cc.ColIndex].CellValue.Equals(1))
{
this.gridControl1[cc.RowIndex, cc.ColIndex].CellValue = 0;
}


}

Regards,
Jisha


VT Vivek Thirumalai October 7, 2009 02:07 PM UTC

That would not work as the underlying data is changed as well.


JJ Jisha Joy Syncfusion Team October 8, 2009 11:01 AM UTC

Hi Vivek,

There is no property setting available to alter the behavior.The cellvalue for the first button will return 0 and cell value of the second button will return 1.

Please let me know if you have any questions.

Regards,
Jisha

Loader.
Up arrow icon