Linq to sql view not updating
Because the Grid View doesn't know what your source will be, it can't really provide the needed functionality.
Since LINQ provides querying capabilities on a generic level, the above problems are no problem.
If you're not already familiar with the basics of LINQ, then you might want to first read this article: Learn The Basics of LINQ.
To sum up LINQ in one sentence (for the purpose of moving on) I would say: "LINQ is a language feature in .
NET 2.0 is lacking some major (yet common) functionality - sorting.
This article will show you how to create a "self-sorting" Grid View using LINQ expression trees.
But if we are going to make a generic "self sorting Grid View", then we have to build our functionality with the limitation of not knowing the data type of the data source or the name of the field that is being sorted.
Because LINQ to objects can handle *any* enumerable objects, and LINQ to SQL is smart enough to pass the sorting logic on to SQL Server, you win no matter what.
For example, imagine if the data source was a collection of Membership Users (via the Membership. Here's how easy it would be to sort using LINQ and the Order By method: That was very easy to do, but that's because we know the data type of our source at compile time.
NET that provides a ton of out-of-the-box functionality for querying data." So why is it that the Grid View control doesn't have the ability to sort by default?
The problem lies in the fact that the data source is very dynamic, could be of any type and could even be just a paged subset of the ultimate source. If your data source was from a SQL table, then you would want to pass the sorting functionality on to the SQL Server itself to gain the most performance.
First, it's important to explain what I mean when I say that the Grid View doesn't have sorting capabilities.You're probably saying to yourself - "I know the Grid View has sorting built in because it has a 'Sort' method and 'Sorting' and 'Sorted' events." And that's true, but those are merely placeholders that allow you to write your own sorting code.