LINQ to dataview........
-
Hi, I have written a linq query and bind it to a gridview. Now i want to implement sorting on gridview columns for which i want this linq query to store in dataview. So how it is possible to store linq query in dataview. the following is the code which i have written to bind gridview.
protected void BindGrid() { try { var employees = from e in DetailContext.Employees orderby e.Emp\_Code descending select new {e.Emp\_Id,e.Emp\_Code,e.F\_Name,e.L\_Name,e.Designation }; GridView1.DataSource = employees; GridView1.DataBind(); } catch (Exception ex) { throw ex; } }
Pranav Dave
-
Hi, I have written a linq query and bind it to a gridview. Now i want to implement sorting on gridview columns for which i want this linq query to store in dataview. So how it is possible to store linq query in dataview. the following is the code which i have written to bind gridview.
protected void BindGrid() { try { var employees = from e in DetailContext.Employees orderby e.Emp\_Code descending select new {e.Emp\_Id,e.Emp\_Code,e.F\_Name,e.L\_Name,e.Designation }; GridView1.DataSource = employees; GridView1.DataBind(); } catch (Exception ex) { throw ex; } }
Pranav Dave
As your starting point DetailContext.Employees is probably a class I think you are in trouble. If you use a datatable/viw as your starting point and AsEnumerable then you can cast the result as a dataview. I do that in this article[^] These look promising[^] but I'll bet they all start from tables
Never underestimate the power of human stupidity RAH