I have a partial view with a combobox. When try to render partial view with modal(contains data from database), it shows only the value field. i want to show the text field of that value field. Help me please.
@(Html.Kendo().ComboBoxFor(m => m.divCode)
.DataTextField("Name")
.DataValueField("ID")
.HtmlAttributes(new { style = "width:160px" })
.SelectedIndex(0)
.AutoBind(false)
.Placeholder("Select Div Code")
.Filter(FilterType.Contains)
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetDivision", "AssetTransaction");
});
})
)
There is no fault i found with your view code. Its just looks fine to me. I think you are doing same as this sample.
I suspect your value assignment to
c.divisioncode, Name = c.divisionname
. Just make sure you are getting and settingvalue and text
properly From your db service calls to view model and assigning correctly. For that you can use and see the "quick watch"while debugging the GetDivision "Action" in AssetTransaction "controller"
.Sample Code i found: