objectdatasource question
For the moment, I'm binding my gridviews by calling a linq query that returns a list collection of objects MyObject. In my gridview, if I'm using a boundfield I set its Datafield property to the name of the property of MyObject and if I'm using an itemtempla开发者_如何学编程te I work with Eval. In my code behind, I have
MyGridview.DataSource = MyListOfMyObject;
MyGridview.DataBind();
All seems to work fine.
What's the purpose of adding an ObjectDataSource control in the aspx file. What does it do extra?
Thanks.
PS: I'm new to the .net framework and I'm still figuring things out.
From here:
ObjectDataSource belongs to the family of data source controls in ASP.NET, which enables a declarative databinding model against a variety of underlying data stores, such as SQL databases or XML. Most data source controls encourage a two-tiered application architecture, where the presentation layer (the page) interacts directly with the backend data provider.
However, it is also common for page developers to encapsulate data retrieval (and optionally business logic) into a component object, introducing an additional layer between the presentation page and data provider. The ObjectDataSource control allows developers to structure their applications using this traditional three-tiered architecture and still take advantage of the ease-of-use benefits of the declarative databinding model in ASP.NET.
精彩评论