Hi Prasad Gurla,
Thanks for contacting Syncfusion Support.
You can have the checkbox in Listbox checked on page load by mapping the CheckBy field of the ListBox to the Model property with Boolean Type. Please find the code snippets below.
|
CSHTML:
<div id="container1">
<p>
Drag
</p>
@Html.EJ().ListBox("List1").Height("302").AllowDrag(true).AllowDrop(true).AllowMultiSelection(true).Datasource(Model).ShowCheckbox(true).ListBoxFields(df => df.Text("text").CheckBy("check")).ClientSideEvents(evt => evt.Create("setheight"))
</div>
CONTROLLER:
public ActionResult Index()
{
List<SkillSet> skill = new List<SkillSet>();
skill.Add(new SkillSet { text = "ASP.NET", check=true }); // set the checkbox field as a Boolean
skill.Add(new SkillSet { text = "ActionScript", check=false});
skill.Add(new SkillSet { text = "Basic", check = true });
:
:
:
return View(skill);
}
|
Output:
When the page is loaded, it will be loaded like the below output with fields checked as given in the data source.
We have also prepared a sample for your reference.
Regards,
Deepa L.