infolink

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();

No comments:

Post a Comment