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.
Syncfusion Feedback

Get radio button value

Thread ID:

Created:

Updated:

Platform:

Replies:

130269 May 3,2017 09:28 AM May 4,2017 09:21 AM ASP.NET Web Forms 1
loading
Tags: RadioButton
Pratheep
Asked On May 3, 2017 09:28 AM

    Hi

  I need  page load rbyes radio button default checked true and Jquery button click event get radio button status (true/false)

 <table>

<tr> 

<td>

<input type="radio" name="radiobutn" id="rbyes" />

<label for="radiobtn">yes</label>

 </td>

<td>

<input type="radio" name="radiobutn" id="rbno" />

<label for="radiobtn">no</label>

</td>

</tr>

</table>

  Thanks
Pratheep              

sureshkumar.P [Syncfusion]
Replied On May 4, 2017 09:21 AM

Hi Pratheep, 
 
Thanks for contacting Syncfusion support, 
 
Query 1: when page load the radio button default state is checked. 
We have checked with your query and you can achieve your requirement by using our existing “checked” property. please refer the below code example 
 
<ej:RadioButton Name="category" ID="Radio1" runat="server"  
                Checked="true" Text="1+ years" ></ej:RadioButton>        
   
 
 
Query 2: in button click, need to get radio button status (true/false): 
               This can be achieved with help of our existing “checked” property which will return the checked state of the radio button. 
 
Here we have used our EJ button and its click event. In this event, we get the checked state of required radio button by using instance of that required button. 
 
Please refer the below code sample 
[body] 
<ej:RadioButton Name="category" ID="Radio1" runat="server" CssClass="RadioNode" Checked="true" Text="1+ years" ></ej:RadioButton>  
 
<ej:Button ID="btn" runat="server" Type="Button" Text="Status" ClientSideOnClick="onBtnClick"></ej:Button>  
[script] 
function onBtnClick() { // triggers while click the ejbutton 
 
            obj = $("#<%=Radio1.ClientID%>").ejRadioButton("instance"); 
               // instance creation for radiobutton 
             
            console.log("the radioButton checked state is : " + obj.model.checked); 
            // obj.model.checked – prints the checked status of the radiobutton             
        } 
 
In the above code example, we have render the first radiobutton as checked state in initial loading by setting our “checked” property as “true” and while click the ejbutton we have get the radiobutton status by using “checked” property with created instance to the radiobutton.  
 
for your convenience, we have attached the sample in the bellow link http://www.syncfusion.com/downloads/support/forum/130269/ze/RadioButton_forum130269232294174   
 
Please find the documentation link to know more about the “checked” property. Refer to the following link https://help.syncfusion.com/api/js/ejradiobutton#members:checked  
Please let us know if you need any further assistance.  
 
Regards, 
Sureshkumar P 


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.

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

;