Hi
Here you can get selected element of Multi selection list using Select2 Jqyery.
Jquery Code
var AuthorList= $("select#AuthorList").select2("val");
-----------------------------------------------------------------------
2. How to set MultiSelection List?
First Get Selected value from your database and add into Hidden Field
like.
Then
Var authlist="";
var a_options = [];
$.each($("#AuthorListoption"), function () {
if (authlist.toLowerCase().indexOf($(this).attr("value")) >= 0) {
a_options.push($(this).attr("value"));
}
});
$("select#AuthorList").select2("val", a_authlist);
HAPPY CODING
Can you tell me, how we can get the values of the selected item to an array or to some other thing, which can then be post back to asp.net for further processing like to add to a database etc.
ReplyDeletea_authlist Is not defined
ReplyDelete