I've got a really strange issue happening.
I've got a DropDownList binding to a remote action in one of my controllers.
When rendering my drop down inside of a asynchronous View Component, the control fails to intialize. No javascript errors, nothing.
I know that the binding is working properly, because as soon as I move the control to a view instead of a view component view, the control initializes fine.
I do not have Deferred() on the control because I know that for partial views the scripts need to be inlined. I am also fairly certain it is not an issue with Deferred, because I have other controls within partial views (not view components) within the app, and the controls load fine.
This issue is specific to asynchronous view components.
This is the control code inside my view component view:
@(Html.Kendo().DropDownList()
.Name("company-selector")
.DataTextField("Text")
.DataValueField("Value")
.DataSource(source =>
{
source.Read(read =>
{
read.Action("GetCompanies", "SuperAdmin");
});
})
.HtmlAttributes(new { style = "width: 100%" })
)
And this is my controller data binding (again which works fine when control is not inside a view. Also hits a break point even with the control in a view component, but the control isn't initialized)
public List<SelectListItem> GetCompanies()
{
var companies = _companyRepository.GetCompanies().ToList();
var companiesSelectList = companies.Select(m => new SelectListItem
{
Text = m.Name,
Value = m.Id.ToString()
}).ToList();
return companiesSelectList;
}