Hi Jeo,
I tried to add a gridview to a usercontrol by drag and drop from the toolbox that i put it in another control then i display it on the page but it didn't success it doesn't appear on the page but when i put in the file userControl.ascx.cs the code of the gridview it appears on the page like
protected void Page_Load(object sender, EventArgs e)
{
string connectionString = ConfigurationManager.AppSettings["MSSQLConnectionString"];
SqlDataSource SqlDataSource1 = new SqlDataSource();
SqlDataSource1.ConnectionString = connectionString;
GridView GridView1 = new GridView();
GridView1.DataSource = SqlDataSource1;
GridView1.DataBind();
this.Controls.Add(GridView1);
}
i want to know why when i put the gridview to the userControl.ascx by drag and drop and then i drag and drop SqlDataSource and i choose the data source for the gridview from the gridview tasks and the view of the gridview is changed and i but on the table in the database two data to see the gridview but i doesn't appear on the page . i don't know why does it happened
Mahmoud El-Sobki