If you followed my previous post
var filteredUser = from U in collection
select new {U.fname,U.lname};
gridView.DataSource = filteredUser;
gridView.DataBind();
Now I am trying to do this:
Format the column names based on properties of U. So for example if U.fname chancges to U.FirstName then I want my gridview column name to reflect the same
If I enable paging through the design view, code compiles but when I launch the web app, it fails stating 'The data source does not support server-side data paging'
Edit::Found this for item # 2 link text
-
1) Are you using
AutoGenerateColumns="True"on your GridView or binding them yourself? I would think that (1) would work ifAutoGenerateColumnsis true. You lose a lot of control over how the columns are displayed, but it ought to work. If you are binding them yourself, I think you will just need to update the bound column names whenever the name of the data field changes or alias the name in theselectclause so that it remains the same.var filteredUser = from U in collection select new {FirstName = U.fname, LastName = U.lname};2) Does your collection support
IEnumerable<U>or justIEnumerable? I believe that LINQ usesSkip()andTake()to support paging so it would need to support the generic enumerable interface.tvanfosson : I think maybe the problem is that you are binding it dynamically rather than declaratively. Thus the data source has no way to communicate back the paging parameters. Can you change it so that you bind the datasource declaratively? You can always replace the result by overriding OnSelecting.
0 comments:
Post a Comment