Action
------------------
Public ActionResult Author()
{
SelectList AuthorList= null;
IEnumerable Author = AuthorList.AsEnumerable().Select(c => new SelectListItem()
{
Text = objauth.ReplaceTagValueToTerm(c.TagValue, c.Term),
Value = c.Id.ToString(),
Selected = true,
});
Newterms = new SelectList(Author, "Value", "Text");
ViewBag.AuthorList= Newterms;
}
}
-------------------------------------------------------------------------------------
View Page
@Html.DropDownList("infoTypes", (SelectList)ViewData["AuthorList"], new { @class = "NewCssdropdown", multiple = "" })
---------------------------------------------------------------------
Jquery
$("#AuthorList").select2(
{
maximumSelectionSize: 4 // Here You can define maximum selection
});
HAPPY CODING
No comments:
Post a Comment