Click here to Skip to main content
15,861,125 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I need a code in C#
like i am having an gridview and above the gridview i am having a drop down for different column in the dropDown i can select all the values or multiple values so can u please advice me on this how can i achieve this .

or in Short i want for gridview

A Multiple Selection DropDownList (a CheckBoxList Inside a DropDownList)


What I have tried:

i have code for gridview but multiple selection i need it
Posted
Updated 20-Jan-17 18:44pm
v2

1 solution

Hi, For List Box
====================
<asp:ListBox runat="server" ID="ddlCarrier" ClientIDMode="Static" SelectionMode="Multiple"
Height="115" class="multi" TabIndex="2">

For Listbox Bind Using ajax
=========================
function bindInitialDropdownList() {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "Pagename/BindCarrier(method name)",
dataType: "json",
async: false,
success: function (data) {

var ddlData = '';
var i = 0;
$.each(data.d, function (key, value) {
ddlData += "" + value + "";
i++;
});
$("#ddlCarrier").append(ddlData);
$("#ClientContentPlaceHolder_hdnCarrierTot").val(i);
setupddlCarrier(true);

if ($('#ClientContentPlaceHolder_hdnCarrierIds').val() != "" && $('#ClientContentPlaceHolder_hdnCarrierIds').val() != "-1")
$('#ddlCarrier').multipleSelect("setSelects",
($('#ClientContentPlaceHolder_hdnCarrierIds').val()), "csv");

},
error: function (xmlHttpRequest, textStatus, errorThrown) {

}
});
}

Apply Web service call to bind MultiSelect DropDown

===================
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public static Dictionary<string, string> BindCarrier()
{
//return Carrier Name ,and ID
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900