Skip to content

set combo box value onload

New Discussion
Karen Michelle Tecson
Karen Michelle Tecson asked on Jan 31, 2020 7:45 AM

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()}]
});
Sign In to post a reply

Replies

  • 0
    Mihoko Kamiishi
    Mihoko Kamiishi answered on Jan 24, 2020 1:02 AM

    Hello,

    initialSelectedItems option can be set only when igCombo is initialized.

    It looks like your combo is already initialized using razor syntax.

    I suggest you select the item using value method instead in this case.

    https://igniteui.com/help/api/2019.2/ui.igcombo#methods:value

    I have created a sample that selects a combo item on load using the above method for your reference.

    Please let me know if I may be of further assistance.

    • 0
      Karen Michelle Tecson
      Karen Michelle Tecson answered on Jan 31, 2020 7:45 AM

      Thank You. I figure it out hahah… I kept on using select attrib when I should be using value instead.

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Karen Michelle Tecson
Favorites
0
Replies
2
Created On
Jan 31, 2020
Last Post
6 years ago

Suggested Discussions

Created on

Jan 31, 2020 7:45 AM

Last activity on

Feb 24, 2026 1:26 PM