Bindinding Dataset and DataTable to Gridview

Posted by Fundaravi under ASP.NET on 6/7/2012 | Points: 10 | Views : 1560 | Status : [Member] | Replies : 4
bind data table to grid view and how to bind the dataset to gridview

Ravindra


Responses

Posted by: Kavi.Sirius on: 6/7/2012 [Member] Starter | Points: 25

Up
0
Down
hi

i cant get ur question
explain clearly

Regards
Kavi.n

Fundaravi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: .Netlearner on: 6/7/2012 [Member] Starter | Points: 25

Up
0
Down
First Declare the Dataset and the Data adapter as follows,
SqlDataAdapter adpt;

DataSet ds;


Then using this u can fill the data in the grid when needed as follows:

   con.Open();

cmd = new SqlCommand("SQL Query", con);
cmd.CommandType = CommandType.StoredProcedure;
adpt = new SqlDataAdapter(cmd);
ds = new DataSet();
adpt.Fill(ds);
dgcategory.DataSource = ds;
dgcategory.DataBind();
dgcategory.Visible = true;
con.Close();


Fundaravi, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ajay.Kalol on: 6/7/2012 [Member] Starter | Points: 25

Up
0
Down
Simply as DataTable

...

...
DataSet ds
DA.Fill(ds);
Grid.DataSource = ds;
Grid.DataBind();


Ajay
ajaypatelfromsanthal.blogspot.in

Fundaravi, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response