Description:
In this example we
explain that how to get the selected Text and Value of the Multiple Select Dropdown
List with Checkboxes in asp.net using jQuery. Or how to call on change event of
the multi select DropDownList and get the selected Text and Value using jQuery.
Or get the multiple selected value of the bootstrap multiselect dropdown list
using jQuery.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="SWS.Test" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<link href="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/css/bootstrap.min.css"
rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.0.3/js/bootstrap.min.js"></script>
<link href="http://cdn.rawgit.com/davidstutz/bootstrap-multiselect/master/dist/css/bootstrap-multiselect.css"
rel="stylesheet"
type="text/css"
/>
<script src="http://cdn.rawgit.com/davidstutz/bootstrap-multiselect/master/dist/js/bootstrap-multiselect.js"
type="text/javascript"></script>
<script type="text/javascript">
$(function
() {
$('[id*=lstCountry]').multiselect({
includeSelectAllOption: true //used for select
all checkbox functionality
});
$('#btnget').click(function()
{
Alert($('[id*=lstCountry]').val());
})
});
</script>
<title>
Multiple Select
(MultiSelect) DropDownList with CheckBoxes in ASP.Net using jQuery</title>
</head>
<body>
<form id="form1" runat="server">
<asp:ListBox ID="lstCountry" runat="server" SelectionMode="Multiple">
<asp:ListItem Text="India" Value="1" />
<asp:ListItem Text="USA" Value="2" />
<asp:ListItem Text="UK" Value="3" />
<asp:ListItem Text="Pakistan" Value="4" />
<asp:ListItem Text="China" Value="5" />
</asp:ListBox>
<input type="button" id="btnget" value="Get Selected Values" /> </form>
</body>
</html>
0 comments:
Post a Comment