Click here to Skip to main content
15,909,199 members

Comments by abhihits (Top 3 by date)

abhihits 15-Sep-11 7:57am View    
Hi Tejas,
Thankyou so much for this beautiful explaination. My query is solved........Thanks a lot.........
abhihits 15-Sep-11 5:16am View    
Thankyou Tejas
I am also doing the same thing but i always getting following error:
"Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition."
Now what does this mean? please provide me solution for above query.
abhihits 15-Sep-11 5:07am View    
Hi anup,
i am trying to bind sqldata source to gridview in '.cs' file but it show error "Both DataSource and DataSourceID are defined on 'GridView1'. Remove one definition." Please give some solution for this:
my coding in cs file is as follow:
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\Database.mdf;Integrated Security=True;User Instance=True");
protected void Page_Load(object sender, EventArgs e)
{
string str = "select * from student";
SqlDataAdapter adp = new SqlDataAdapter(str, con);
DataSet set1 = new DataSet();
adp.Fill(set1);
GridView1.DataSource = set1.Tables[0];
GridView1.DataBind();
}
}