set combo box value onload
New DiscussionHere is my controller:
IEnumerable<SelectListItem> tableList = filteredResultFinal.Select(i => new SelectListItem
{
Value = i,
Text = i,
Selected = i.Equals(tableName)
});
{
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()
)
.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()}]
});
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()}]
});
Sign In
to post a reply
Replies
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Favorites
0 Replies
2 Created On
Jan 31, 2020 Last Post
6 years ago