Hi ,
Check this
it's working with me
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindGridView("select * from ODetails", GridView1);
GridView1.DataBind();
}
}
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["testConnectionString"].ConnectionString);
SqlDataAdapter dap;
void BindGridView(string qr, GridView grd)
{
dap = new SqlDataAdapter(qr, con);
DataSet ds = new DataSet();
dap.Fill(ds);
grd.DataSource = ds.Tables[0].DefaultView;
grd.DataBind();
}
Best Regards
M.Mitwalli