I have an ASP.NET MVC3 View that has a Telerik Grid that uses a viewmodel for its data.
One of the requirements is that we need a dropdown control in one of the grid columns which gets data from a lookup table.
Being relatively new to MVC3, I figured that since the Razor View can only use one model directive IE:
@model IEnumerable<MarketingWebsiteTools.Models.EditableItemInfo>
that the dropdown lookup valueswould need to be mapped back to the ViewModel along with the data for the grid.
At this point it might be pertinent to mention that I'm using Html.Telerik().ComboBox() in a ClientTemplate like this:
.Columns(columns =>
{
columns.Bound(o => o.ItemNmbr).Width(65);//.ClientTemplate("<label name='ProductIdentifier' />");
columns.Bound(o => o.Description).Width(65)
.ClientTemplate(Html.Telerik().ComboBox()
.Name("Special")
**.BindTo(new SelectList())**
.ToHtmlString());
columns.Bound(o => o.Start_Date).Width(75).Format("{0:d}");
columns.Bound(o => o.End_Date).Width(75).Format("{0:d}");
columns.Bound(o => o.PromotionText).Width(75);
columns.Command(commands => commands.Delete()).Width(125).Title("Delete");
})
My question is: In respect to the BindTo(new SelectList()), I need to provide a parameter of type System.Collections.Generic.IEnumerable, however I'm unsure how to get that from my viewmodel, or perhaps, I should be getting that lookup data another way...
I looked at this example: http://www.telerik.com/community/forums/aspnet-mvc/combobox/bindto.aspx
However, My code or intellisense doesn't seem to be recognizing any models IE: .BindTo(new SelectList(Model.))
I also looked at this example: How to insert drop down list box in a Telerik grid
where it looks like there's a call to a method in a controller, but again, no access to that controller..
thanks in advance for any help.
doug