infolink

Showing posts with label Database. Show all posts
Showing posts with label Database. Show all posts

Monday, 27 August 2012

Bind GridView using DataSet

This tutorial is about bind gridview using dataset. First add dataset and drop the table in the dataset. then go to the page load our any button event and write the code.
These are the simple steps to bind the gridview:

Add DataSet
Add DataSet

Add table in DataSet
Add table in DataSet

Now go to the page load event and write this code:

DataSet1TableAdapters.tbl_PersonInfoTableAdapter obj_adapter = new DataSet1TableAdapters.tbl_PersonInfoTableAdapter();
        DataSet1.tbl_PersonInfoDataTable obj_dt = obj_adapter.GetData();
        GridView1.DataSource = obj_dt;
        GridView1.DataBind();

Sunday, 26 August 2012

Display Data in the GridView from database using SqlDataSource in asp.net

This tutorial is about how to retrieve data from the database and display in the GridView using SqlDataSource in ASP.NET. It is very simple with the SqlDataSource.
Here is steps.

Step 1:

On the page add the GridView control. after that select the GridView and click on the top right side button a GridView Tasks window will appear now from this window choose the new data source from the DropDownList. Like this:
Select new data source
Select new data source