Loading...

Build Display Text and Value of Multiple RadioButtonList using jQuery

View: 478    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: 169    Download: 3   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...

  • AngularJS and REST API

    AngularJS and REST API

    View: 315    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: 250    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: 226    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: 249    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...

  • Brief Introduction of SocketPro High Performance and Scalable Persistent Message Queue

    Brief Introduction of SocketPro High Performance and Scalable Persistent Message Queue

    View: 569    Download: 0   Comment: 0

    Category: Javascript     Fields: Other

    Continuous in-line request/result batching, real-time stream sending/processing, asynchronous data transferring and parallel computation for best performance and scalability

  • Iteration Over Java Collections with High Performance

    Iteration Over Java Collections with High Performance

    View: 219    Download: 0   Comment: 0

    Category: Javascript     Fields: Other

    Java developers usually deal with Collections such as ArrayList, HashSet, Java 8 come with lambda and streaming API helps us to easily work with Collections. In most cases, we work with few thousands of items and performance isn't a concern. But in...

  • SR2JLIB - A Symbolic Regression Library for Java

    SR2JLIB - A Symbolic Regression Library for Java

    View: 215    Download: 0   Comment: 0

    Category: Javascript     Fields: Other

    Grammar-Guided Genetic Programming library featuring: multi-threading, just-in-time compilation of individuals, dynamic class loading, and JNI interfacing with C/C++ code

 
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