Pages

Saturday, 7 December 2013

Easy Way in Displaying Data in GridView

Here I will show you how to Fill a grid view Using Entity Frame work.

First open visual studio and create the stuff that's needed for us like add a solution and add an Empty web application to that :


next follow these steps:


STEP:1--->Add a web form to our Empty web application
STEP:2--->Add a ADO.NET Data Entity Model












STEP:3--> NOW GET THE CONNECTION STRING IN WEB CONFIG AND WRITE IN OUR HOME.ASPX.CS FILE
                             


Now get into the main coding part...

I have written a function BindGrid()  to bind data to our grid

and coming to BindGrid() function  first line is using( var DbMember = new PracticeEntities()) which is Entity frame work and now comes our Sql command see its a bit different from regular sql commands. Al we need to do is writing that query and convert into list and assign it to datsource




Put a break point over there and run the application





Now there's our list of  our table data




Hope you liked it. Happy Coding





















No comments:

Post a Comment