Click here to Skip to main content
15,901,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to store the grid view data into data table.My code as follows:
C#
if (rbw.Checked == true)
{
  Sql = "select Category,Questions,Answers from Tb_Staff_Doubt_Register Where Questions like '%" + Txtsearch.Text + "%' or Answers like '%" + Txtsearch.Text + "%' ";
  Dr = SCon.ReadSql(Sql);
  GridView1.DataSource = Dr;
  GridView1.DataBind();
  GridView1.Visible = true;
}

How to store the above grid view data into data table? Please help me.

Regards,
Narasiman P.
Posted
Updated 15-Oct-13 2:05am
v2

1 solution

just copy and paste the below code all your grid data will be in datatable dt.



C#
if (rbw.Checked == true)
{
Sql = "select Category,Questions,Answers from Tb_Staff_Doubt_Register Where Questions like '%" + Txtsearch.Text + "%' or Answers like '%" + Txtsearch.Text + "%' ";
Dr = SCon.ReadSql(Sql);
GridView1.DataSource = Dr;
GridView1.DataBind();
GridView1.Visible = true;
DataTable dt=GridVeiw1.DataSource as DataTable;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900