jeudi 22 janvier 2015

Multiselect dropdownlist with Checkbox in asp.net

I'm using bootstrap multiselect dropdown list with checkbox.its working well without master form.but its not working with master forms:



<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<script type="text/javascript" src="http://ift.tt/1fEahZI"></script>
<link href="http://ift.tt/1L4JlTu"
rel="stylesheet" type="text/css" />
<script type="text/javascript" src="http://ift.tt/1L4Jne4"></script>
<link href="http://ift.tt/1EzpWpf"
rel="stylesheet" type="text/css" />
<script src="http://ift.tt/1EzpXJJ"
type="text/javascript"></script>
<script type="text/javascript">
$(function() {
$('[id*=lstFruits]').multiselect({
includeSelectAllOption: true
});
});
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ListBox ID="lstFruits" runat="server" SelectionMode="Multiple">
<asp:ListItem Text="Mango" Value="1" />
<asp:ListItem Text="Apple" Value="2" />
<asp:ListItem Text="Banana" Value="3" />
<asp:ListItem Text="Guava" Value="4" />
<asp:ListItem Text="Orange" Value="5" />
</asp:ListBox>
<asp:Button ID="Button1" Text="Submit" runat="server" OnClick="Submit" />

</asp:Content>


C# Code:



protected void Submit(object sender, EventArgs e)
{
string message = "";
foreach (ListItem item in lstFruits.Items)
{
if (item.Selected)
{
message += item.Text + " " + item.Value + "\\n";
}
}
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", "alert('" + message + "');", true);
}


I have referred


this article:


by using this code i have a drop down list on the Page but the drop down click event it not firing i couldn't see any list. kindly assist me to solve this.





Aucun commentaire:

Enregistrer un commentaire