Class RadioButtonField
Represents a radio button field in the SfPdfViewer2 component.
Inherited Members
Namespace: Syncfusion.Blazor.SfPdfViewer
Assembly: Syncfusion.Blazor.SfPdfViewer.dll
Syntax
public class RadioButtonField : FormFieldInfo
Remarks
Initializes a new instance of the RadioButtonField class with the default field type set to "RadioButton."
This field allows users to select a single option from a group of radio buttons in interactive PDF forms.
Examples
RadioButtonField radioButtonField = new RadioButtonField();
radioButtonField.Name = "Gender";
radioButtonField.Value = "Male"; // Sets the selected option.
await viewer.AddFormFieldsAsync(new List<FormFieldInfo> { radioButtonField });
Constructors
RadioButtonField()
Initializes a new instance of the RadioButtonField class in the SfPdfViewer2 component.
Declaration
public RadioButtonField()
Remarks
This constructor creates a radio button field with the default field type set to "RadioButton."
Radio button fields allow users to select a single option from a group in interactive PDF forms.
Examples
RadioButtonField radioButtonField = new RadioButtonField();
radioButtonField.Name = "Gender";
radioButtonField.Value = "Male"; // Sets the selected radio button option.
await viewer.AddFormFieldsAsync(new List<FormFieldInfo> { radioButtonField });
Properties
IsSelected
Gets or sets a value indicating whether the RadioButtonField in the SfPdfViewer2 component is selected.
Declaration
public bool IsSelected { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean | A System.Boolean indicating whether the radio button is selected. |
Remarks
When IsSelected is set to true
, the radio button is selected.
If set to false
, the radio button remains unselected.
In a group of radio buttons, only one option can be selected at a time.
Examples
RadioButtonField radioButtonField = new RadioButtonField();
radioButtonField.Name = "Gender";
radioButtonField.Value = "Male";
radioButtonField.IsSelected = true; // Selects the "Male" radio button
Value
Gets or sets the value associated with the RadioButtonField in the SfPdfViewer2 component.
Declaration
public string Value { get; set; }
Property Value
Type | Description |
---|---|
System.String | A System.String representing the selected value of the radio button field.
The default value is an empty string ( |
Remarks
The Value property represents the option selected within a radio button group. This property stores the assigned value of the radio button when it is in the selected state. If the radio button is not selected, this property will return an empty string or the default value.
Examples
The following example demonstrates how to assign and retrieve a selected value for a radio button field:
RadioButtonField radioButtonField = new RadioButtonField();
radioButtonField.Name = "PaymentMethod";
radioButtonField.Value = "CreditCard"; // Assigns "CreditCard" as the selected option
string selectedValue = radioButtonField.Value; // Retrieves the selected option