I'm developing a SharePoint solution, In an Application Page, I want to place SPGridView and I have to bind it with SQL server data.

Is it possible and if yes, how?

2 Answers 2


Yes it is possible, here is a basic example:

protected void Page_Load(object sender, EventArgs e)
    const string ConnectionString = @"Persist Security Info=False; Integrated Security=SSPI; Server=hercules\sqlexpress;Connect Timeout=30;Database=TestDB;";
    SqlConnection con = new SqlConnection(ConnectionString);
    SqlCommand cmd = new SqlCommand("select * from CustomerTable", con);
    SqlDataAdapter adp = new SqlDataAdapter(cmd);
    DataSet ds = new DataSet();

   DataTable dt = ds.Tables[0];
    gridview1.DataSource = dt.DefaultView;

from here


yes we can bind data to spgridview same as gridview.

  • Can you please add more details to this answer about how that is done? Your answer is not as helpful as it could be right now :) Mar 25, 2015 at 7:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.