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

How to add two radio buttons (Yes and No) in sfDataGrid column

Thread ID:

Created:

Updated:

Platform:

Replies:

142932 Feb 26,2019 09:59 AM UTC Mar 5,2019 09:05 AM UTC Xamarin.Android 5
loading
Tags: SfDataGrid
Deepa
Asked On February 26, 2019 09:59 AM UTC

Hi,

I want to add two radio buttons (Yes and No) inside template column of the sfDataGrid. Could you please share the example for this?

I want this kind of layout inside sfDataGrid column:



Subburaj Pandian Veluchamy [Syncfusion]
Replied On February 27, 2019 11:09 AM UTC

Hi Deepa, 
 
Thank you for contacting Syncfusion support. 
 
We have checked your requirement of “Showing two radio buttons inside the DataGrid column” in Xamarin.Forms can be achieved using CellTemplate of GridTemplateColumn. You can set the desired DataTemplate in the GridTemplateColumn based on your requirement. 
 
We have prepared sample based on your requirement, please find the sample by the following link. 
 
Sample link: GridEditSample 
 
In the sample, we have added columns and in the last column we have handled two Switch in the layout. 
 
We hope this helps. Please let us know, if you need any further assistance. 
 
Regards,
Subburaj Pandian V  
 


Deepa
Replied On March 1, 2019 09:48 AM UTC

The solution you provided is using xamarin.forms.
I want the solution for native xamarin android.

Please provide me the sample in native xamarin android

Subburaj Pandian Veluchamy [Syncfusion]
Replied On March 4, 2019 09:34 AM UTC

Hi Deepa, 
 
Sorry for the inconvenience caused. 
 
We have prepared sample based on your requirement “Showing radio button inside the DataGrid column” in Xamarin.Android. Please find the sample by the following link.

Sample link: GridTemplateColumn_Droid 
 
In the sample, we have loaded Radio Button inside the DataGrid column by using UserCellType property of GridTextColumn. Using this you can pass the required view to the custom column of Grid. 
 
You can refer the same by the following UG documentation, 
 
 
We hope this helps. Please let us know, if you have any concern. 
 
Regards,
Subburaj Pandian V  


Deepa
Replied On March 4, 2019 09:49 AM UTC

I already tried this code. But this adds only one radio button to the column.
I want to add two radio buttons 'Yes', 'No' to the column.

Whenever i try to add second radio button, it gives me empty column.

I have waiting for 3 days to add this functionality. Please provide the sample as soon as possible. 

Subburaj Pandian Veluchamy [Syncfusion]
Replied On March 5, 2019 09:05 AM UTC

 
Hi Deepa, 
  
Thank you for the update. 
  
We have prepared the sample based on your requirement “Load two radio button in template column” and please refer the following code snippet for Custom Cell class changes. 
  
[C#] 
public class CustomCell : GridCell 
{ 
    LinearLayout layout; 
    RadioButton radioButton; 
    RadioButton radioButton1; 
  
    public CustomCell(Context context) : base(context) 
    { 
        layout = new LinearLayout(this.Context); 
        radioButton = new RadioButton(this.Context); 
        radioButton1 = new RadioButton(this.Context); 
  
        layout.AddView(radioButton); 
        layout.AddView(radioButton1); 
  
        this.AddView(layout); 
    } 
  
    protected override void UnLoad() 
    { 
        if (this.Parent != null) 
            (this.Parent as VirtualizingCellsControl).RemoveView(this); 
    } 
  
    protected override void OnLayout(bool change, int l, int t, int r, int b) 
    { 
        this.layout.Layout(0, 0, this.Width, this.Height); 
    } 
  
    protected override void OnMeasure(int widthMeasureSpec, intheightMeasureSpec) 
    { 
        base.OnMeasure(widthMeasureSpec, heightMeasureSpec); 
        this.layout.Measure(widthMeasureSpec, heightMeasureSpec); 
    } 
  
    protected override void OnDraw(Canvas canvas) 
    { 
        base.OnDraw(canvas); 
        this.radioButton.Text = "Yes"; 
        this.radioButton1.Text = "No"; 
    } 
} 
  
We have attached the sample in following location. 
  
 
Please let us know, if this helpful. 
 
Regards,
Subburaj Pandian V 
 


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

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

;