Paging Control Gridview VS-2008
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 column names based on U properties. For example, if U.fname chancges for U.FirstName then I want the gridview column name to display the same
-
If I allow paging through design view, compile the code, but when I run the web application, it cannot state: "Data source does not support server side paging"
Edit :: Found this for item # 2 link text
1) Are you using AutoGenerateColumns="True"
in your GridView or are you binding them yourself? I think (1) will work if AutoGenerateColumns
true. You lose a lot of control over how the columns are displayed, but it should work. If you bind them yourself, I think you just need to update the associated column names whenever the data field name changes or the name alias in the sentence select
so that it stays the same.
var filteredUser = from U in collection
select new {FirstName = U.fname, LastName = U.lname};
2) Does your collection support support IEnumerable<U>
or just IEnumerable
? I suppose LINQ is using Skip()
it Take()
to support paging as well, so it will need to support a generic enum interface.
source to share