Put GridView in UserControl

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

Please do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.

This forum is for discussing mojoPortal development

This forum is only for questions or discussions about working with the mojoPortal source code in Visual Studio, obtaining the source code from the repository, developing custom features, etc. If your question is not along these lines this is not the right forum. Please try to post your question in the appropriate forum.

You can monitor commits to the repository from this page. We also recommend developers to subscribe to email notifications in the developer forum as occasionally important things are announced.

Before posting questions here you might want to review the developer documentation.

Do not post questions about design, CSS, or skinning here. Use the Help With Skins Forum for those questions.
This thread is closed to new posts. You must sign in to post in the forums.
2/6/2007 9:26:13 AM
Gravatar
Total Posts 8

Put GridView in UserControl

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
2/6/2007 3:51:15 PM
Gravatar
Total Posts 18439

Re: Put GridView in UserControl

Hi,

This doesn't seem like a mojoportal question and I'm really not sure I understand even what you are asking.

I really don't know much about SqlDataSource, I never use that.

In your code I don't see how its supposed to know what table to use, you are not specifying a table anywhere that I can see.

Hope it helps,

Joe
You must sign in to post in the forums. This thread is closed to new posts.