C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Bind Gridview using LINQ


Posted Date: 18 Sep 2008    Resource Type: Code Snippets    Category: ASP.NET GridView

Posted By: Athira Appukuttan       Member Level: Diamond
Rating:     Points: 10



Bind Gridview using LINQ

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
BindGrid();
}

private void BindGrid()
{
VetcareDataContext vetcare = new VetcareDataContext();
var Employee = from e in vetcare.Pay_Employees orderby e.Name select e;
gvEmployee.DataSource = Employee;
gvEmployee.DataBind();
}
protected void gvEmployee_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
gvEmployee.PageIndex = e.NewPageIndex;
BindGrid();
}
}




Responses

Author: Athira Appukuttan    18 Sep 2008Member Level: Diamond   Points : 1
While sending time i can't attach Code.
Soo please refer the below attachement.




.NET 3.5.zip
Feedbacks      
Popular Tags   What are tags ?   Search Tags  
LINQ  .  Gridview  .  Bind  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Gridview on Edit by using templatefield and link button
Previous Resource: How to get Grid with Combobox
Return to Discussion Resource Index
Post New Resource
Category: ASP.NET GridView


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design

UK Conference calling Company

Contact Us    Privacy Policy    Terms Of Use