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.

Radiobutton in grid

Thread ID:

Created:

Updated:

Platform:

Replies:

90454 Oct 1,2009 06:57 PM Oct 8,2009 07:01 AM Windows Forms 6
loading
Tags: GridControl
Vivek Thirumalai
Asked On October 1, 2009 06:57 PM

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

Vivek Thirumalai
Replied On October 1, 2009 07:05 PM

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

Lingaraj S [Syncfusion]
Replied On October 2, 2009 09:50 AM

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.

Vivek Thirumalai
Replied On October 5, 2009 06:53 PM

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.

Jisha Joy [Syncfusion]
Replied On October 6, 2009 07:47 AM

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

Vivek Thirumalai
Replied On October 7, 2009 10:07 AM

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

Jisha Joy [Syncfusion]
Replied On October 8, 2009 07:01 AM

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

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.

;