Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
15
set combo box value onload
posted

Here is my controller:

 IEnumerable<SelectListItem> tableList = filteredResultFinal.Select(i => new SelectListItem
            {
                Value = i,
                Text = i,
                Selected = i.Equals(tableName)
            });
  return View(tableList);
here is my VIEW:
Combo box:
@(Html.Infragistics().Combo()
                            .Width("270px")
                            .ID("combo")
                            .DataSource(Model)
                            .ValueKey("Value")
                            .TextKey("Text")
                            .DataBind()
                            .Render()
            )
JavaScript:
 $("#combo").igCombo({
            inputName: "tableName",
            width: "270px",
            filteringType: "local",
            filteringCondition: "contains",
            highlightMatchesMode: "contains",
            valueKey: "value",
            placeHolder: "Select Equipment...",
            dropDownOrientation: "bottom",
            allowCustomValue: false,
            loadOnDemandSettings: {
                enabled: true,
                pageSize: 10
            },
            initialSelectedItems:[{ value: $("#myViewData").val()}]
        });