 |
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.x and 2.0 Application Design section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|

March 2nd, 2004, 11:42 AM
|
Registered User
|
|
Join Date: Jul 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
How to put a control inside a table cell?
'Does anyone know how to put a control- label,panel inside the table cell of table web control? Help!
I've seen an example but each time I drop a control in the cell, I lose it. Maybe there is a technique.
|

March 2nd, 2004, 11:46 AM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Where are you trying to do this? In the markup or code-behind?
|

March 2nd, 2004, 12:16 PM
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 1,110
Thanks: 0
Thanked 3 Times in 3 Posts
|
|
Try typing text first like 'as' in the table cell, then drop the control in between the 'a' and 's'.
|

March 2nd, 2004, 05:31 PM
|
Registered User
|
|
Join Date: Jul 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by zach2004
'Does anyone know how to put a control- label,panel inside the table cell of table web control? Help!
I've seen an example but each time I drop a control in the cell, I lose it. Maybe there is a technique.
|
In the code behind. I just want to drop a label control in the table cell and I don't know why it does'nt do it.
Thanks
|

March 2nd, 2004, 05:40 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
How do you "drop" a control in a table cell in the Code Behind? You seem to be mixing up two concepts here. The Design View allows for adding controls using drag and drop, while the Code Behind is used to add controls programmatically.
In Code Behind, you can simple add one control to another, using its Controls.Add method, like this:
MyTableCell.Controls.Add(LoadControl("/Controls/AnotherControl.ascx"));
or
Label newLabel = new Label();
newLabel.Text = "Bla Bla Bla";
MyTableCell.Controls.Add(newLabel);
In both cases, MyTableCell could be an HTML Table cell to which you can add other controls.
Does this help?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|

March 2nd, 2004, 06:03 PM
|
 |
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
|
|
Ah... perhaps you mean in the markup. I failed to provide that as the third option.
To add a label control in the markup (HTML view) of your web form (or user control) you simply type the following inside the cell's <td> and </td> tag:
<asp:label runat="server" id="myLabel" />
You cannot drag-and-drop from the toolbar to the markup (or code-behind as noted by Imar).
Peter
------------------------------------------------------
Work smarter, not harder.
|

March 2nd, 2004, 06:49 PM
|
Registered User
|
|
Join Date: Jul 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by zach2004
'Does anyone know how to put a control- label,panel inside the table cell of table web control? Help!
I've seen an example but each time I drop a control in the cell, I lose it. Maybe there is a technique.
I mean it should be in the design. I'm sorry. The example I saw which was already the solution and in design mode -if I drag the table on the edge all the controls in the table cells are binded that they move also with the table. So my beginner's question then is can I drag a label control in a table cell in design mode -not HTML or code behind methods although both are possible. Thanks!
|
|

March 8th, 2004, 03:28 PM
|
Registered User
|
|
Join Date: Jul 2003
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
quote:Originally posted by zach2004
'Does anyone know how to put a control- label,panel inside the table cell of table web control? Help!
I've seen an example but each time I drop a control in the cell, I lose it. Maybe there is a technique.
|
I undestood this pretty well now.Thanks!
|
|
 |