Loading...

Build Display Text and Value of Multiple RadioButtonList using jQuery

View: 435    Dowload: 0   Comment: 0   Post by: hanhga   Category: Javascript   Fields: Other

RadioButtonList

  • It is an asp.net control which renders the list of radio buttons as a standards html on browser
  • Radio buttons lets give users to select a single choice at a time e.g (Male or Female)

Following example display the text and value of the multiple selected radio button from multiple  radiobutton list in asp.net using JQuery

jQuery Code snippet.

<script type="text/javascript" src="Scripts/jquery-1.8.2.js"></script> <!-- call jquery file or library into asp.net page --->
    <script>
        $(document).ready(function() { // this is a function which is called by browser when it loads a webpage
 
            $('[id$="TT_Checkbutton"]').click(function (e) {  // get button object, trigger it's click event and call anonymous function
 
                e.preventDefault();
                var $selected = $('table.tbl :radio:checked'); // get all checked radio buttons inside the table and assign into $selected variable
                $("#TT_paragraph").text(''); // text() method set text for selected object, here it will be set as an empty string
 
                $selected.each(function () { // each(), which specifies the method for each checked radio buttons and execute
 
                    var $sel = $(this); // assign checked radio buttons into $sel
                    $("#TT_paragraph")
                    .append("<b>Index: </b>" +
                    $sel.val() + "<br/>") // append the text and value of checked radio buttons into paragraph using append(), next and text() method
 
                    .append("<b>Value: </b>" +
                    $sel.next().text() + "<br/>");
 
                });
 
            });
 
        });
 
    </script>

ASP.NET Code snippet

<h2>How To Display Text and Value of Multiple RadioButtonList using jQuery</h2><br />
<!--- Following code renders the radio button lists, label and a button on browser --->
 
        <asp:Label runat="server" Text="Select a Radio Button From Each of these lists and click the Button"></asp:Label>
        <br/> <br/>
        Most like site: 
        <asp:RadioButtonList ID="TT_radiobtnList1" runat="server" class="tbl">
        <asp:ListItem Text="google.com" Value="0"></asp:ListItem>
        <asp:ListItem Text="bing.com" Value="1"></asp:ListItem>
        <asp:ListItem Text="yahoo.com" Value="2"></asp:ListItem>
        </asp:RadioButtonList>
        <br />
        I am a: <br />
        <asp:RadioButtonList ID="TT_radiobtnList2" runat="server" class="tbl">
        <asp:ListItem Text=".Net Developer" Value="3"></asp:ListItem>
        <asp:ListItem Text="PHP Developer" Value="4"></asp:ListItem>
        <asp:ListItem Text="Java Developer" Value="5"></asp:ListItem>
        </asp:RadioButtonList>
        <br />
        I visit your sites : <br />
        <asp:RadioButtonList ID="TT_radiobtnList3" runat="server" class="tbl">
        <asp:ListItem Text="2-3 times a week" Value="6"></asp:ListItem>
        <asp:ListItem Text="Once a Month" Value="7"></asp:ListItem>
        <asp:ListItem Text="None of the above" Value="8"></asp:ListItem>
        </asp:RadioButtonList>
        <br />
        <asp:Button ID="TT_Checkbutton" runat="server" Text="Scroll"/>
 
        <br /><br />
        <p id="TT_paragraph"></p>

Build Display Text and Value of Multiple RadioButtonList using jQuery

Following example display the text and value of the multiple selected radio button from multiple radiobutton list in asp.net using JQuery

Posted on 22-08-2016 

Comment:

To comment you must be logged in members.

Files with category

  • Mini Youtube Using ReactJS

    Mini Youtube Using ReactJS

    View: 55    Download: 2   Comment: 0

    Category: Javascript     Fields: none

    This is one the best starter for ReactJS. MiniYoutube as the name suggests is a youtube like website developed using reactJS and youtube API. This project actually let's you search , play and list youtube videos. Do check it out and start learning...

  • Angular 6 Starter with Laravel 5.6 API Service

    Angular 6 Starter with Laravel 5.6 API Service

    View: 118    Download: 1   Comment: 0

    Category: Javascript     Fields: none

    Angular 6 and Laravel 5.6 This project is a starter for creating interface with Angular using bootstrap && css && sass and using Laravel 5.6 for api requests. Demo Installation This project is divided in two parts (projects) and before use them you...

  • Simple Richtext Editor Based on pellJS

    Simple Richtext Editor Based on pellJS

    View: 46    Download: 0   Comment: 0

    Category: Javascript     Fields: none

    A simple visual editor for websites using the pell javascipt. It also has the option to switch between visual editor mode and source code mode. I will upload an update for new functionality soon. Source Code Editor Visual Editor

  • Data Visualization for BI: How to Design Layouts for .NET Financial Reports

    Data Visualization for BI: How to Design Layouts for .NET Financial Reports

    View: 69    Download: 0   Comment: 0

    Category: Javascript     Fields: Other

    With the Active Reports Server, you can have a multi-tenant environment where users from various departments, companies, or other specifications can log in, view their reports (and only their reports), export the data, or set up a distribution...

  • AngularJS and REST API

    AngularJS and REST API

    View: 246    Download: 0   Comment: 0

    Category: Javascript     Fields: Other

    This is a tutorial for those interested in a quick introduction to AngularJS and REST API. We will build the familiar Periodic Table of the Elements found in every chemistry textbook, and allow the user to select a Chemical Element by clicking on...

  • Collective Intelligence, Recommending Items Based on Similar Users' Taste

    Collective Intelligence, Recommending Items Based on Similar Users' Taste

    View: 202    Download: 0   Comment: 0

    Category: Javascript     Fields: Other

    Using Collaborative Filtering to find people who share tastes, and for making automatic recommendations based on things that other people like.

  • Think Like a Bird for Better Parallel Programming

    Think Like a Bird for Better Parallel Programming

    View: 184    Download: 0   Comment: 0

    Category: Javascript     Fields: Other

    Coding an application to run in parallel is hard, right? I mean, it must be hard or we’d see parallel programs everywhere. All we'd see are slick parallel apps that use every available core effortlessly. Instead multi-threaded apps are the exception...

  • Getting Started with the Bing Search APIs

    Getting Started with the Bing Search APIs

    View: 197    Download: 0   Comment: 0

    Category: Javascript     Fields: Other

    Bing Search API is a set of REST interfaces that find web pages, news, images, videos, entities, related searches, spelling corrections, and more in response to queries from any programming language that can generate a web request. Applications that...

 
File suggestion for you
Loading...
File top downloads
Loading...
Loading...
Codetitle - library source code to share, download the file to the community
Copyright © 2018. All rights reserved. codetitle Develope by Vinagon .Ltd