Code.GeekInterview.com
  I am new, Sign me up!
 
Code Samples ASP.NET
 

Bind Gridview using LINQ


Code ResourceAuthor: athiraappukuttan  

Difficulty Level: Beginner

Published: 12th Feb 2009   Read: 2206 times  

Filed in: ASP.NET
Add Comment


 


Bind Gridview using LINQ
 


Sample Code
  1. using System;
  2. using System.Configuration;
  3. using System.Data;
  4. using System.Linq;
  5. using System.Web;
  6. using System.Web.Security;
  7. using System.Web.UI;
  8. using System.Web.UI.HtmlControls;
  9. using System.Web.UI.WebControls;
  10. using System.Web.UI.WebControls.WebParts;
  11. using System.Xml.Linq;
  12.  
  13. public partial class _Default : System.Web.UI.Page
  14. {
  15.     protected void Page_Load(object sender, EventArgs e)
  16.     {
  17.         BindGrid();
  18.     }
  19.  
  20.     private void BindGrid()
  21.     {
  22.         VetcareDataContext vetcare = new VetcareDataContext();
  23.         var Employee = from e in vetcare.Pay_Employees orderby e.Name select e;
  24.         gvEmployee.DataSource = Employee;
  25.         gvEmployee.DataBind();
  26.     }  
  27.     protected void gvEmployee_PageIndexChanging(object sender, GridViewPageEventArgs e)
  28.     {
  29.         gvEmployee.PageIndex = e.NewPageIndex;
  30.         BindGrid();
  31.     }
  32. }
Copyright GeekInterview.com


Next Article: Simple Photo Gallery with ASP.NET 2.0


 

Latest Code Samples

 

Popular Code Samples

 

Related Code Samples

 

Post Comment


Members Please Login

Name:  Email: (Optional. Used for Notification)

Title:
 
Comment:
Validation Code: <=>  (Enter this code in text box)





Popular Coders

# Coder NameHits
1. chowsys7595
2. athiraappukuttan2207

Active Coders

# Coder NameCodes
1. chowsys2
2. athiraappukuttan1

Refined Tags

 

Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact  

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape