Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
615
Understanding the MVC Helper Demo
posted

Hi there, sorry if this seems totally basic, but I'm having trouble understanding the MVC Helper demo of the Combo Box here:

http://www.igniteui.com/combo/aspnet-mvc-helper

Specifically, I have a question about the ComboData() method:

[ComboDataSourceAction]
[ActionName("employee-combo-data")]
public
ActionResult ComboData()
{

IEnumerable
<Employee> employees = RepositoryFactory.GetEmployeeRepository().Get();
return
View(employees);
}


Why does this return a View instead of simply returning the employees list? I tried doing this in one of my own projects, and the framework kept complaining
that there was no view named "xyz" (I had chosen a different name than ComboData()), which of course there wouldn't be because this method is just gathering up the list of things to put in the combo (right?).

Maybe it would help if I describe the way I understand the program flow.

1) View() method is called from some controller method.
2) When the @Infragistics() call is encountered within the view, the DataSource URL is called to retrieve the collection (perhaps GetComboData()).
3) GetComboData() provides the Data to be wired up into the combo box, and the view finishes rendering.

Does this sound accurate? Thanks for any advice you can offer me!