objectdatasource

Paging & Sorting grids with ASP.Net MVC

[亡魂溺海] 提交于 2019-11-27 02:42:43
I'm new to MVC, and am not following how you'd do paging and sorting on a grid. I'm used to using the asp.Net GridView control with an ObjectDataSource pointed at objects in our business layer - and in that case the ODS handles all of the paging & sorting using the methods that our ORM generates on the objects. I've looked at using the same ORM with MVC - and things work out fine there - i just loop thru the collections to build the table on the page - but without the ODS to handle the paging & sorting, i'm confused as to how I'd handle that. Would I have a separate controller for the paging

SqlDataSource vs ObjectDataSource

老子叫甜甜 提交于 2019-11-27 01:37:19
问题 If a web page needs some data, why not just have a SQLDataSource call a stored procedure? Why use an ObjectDataSource to call a business object that then calls the stored procedure? I understand that other apps (lets say desktop apps) built on the .net framework can access the business objects, but what if the application will always be only a web app? To be more clear: When should one use an SqlDataSource or ObjectDataSource ? How does one motivate the choice? 回答1: Having just a

GridView bound with Properties of nested class

依然范特西╮ 提交于 2019-11-26 11:28:33
问题 I have an object map similar to what\'s listed below. When I try to bind the properties of NestedClass in a GridView I get the error: \"A field or property with the name \'NestedClass.Name\' was not found on the selected data source.\" The GridView is bound to an ObjectDataSource and the ObjectDataSource is bound to a fully populated instance of BoundClass. Is there any way around this? Sample classes: public class BoundClass { public string Name { get; set; } public NestedClass NestedClass {