Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > ASP.NET 1.x and 2.0 Application Design
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old March 2nd, 2004, 11:42 AM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.

  #2 (permalink)  
Old March 2nd, 2004, 11:46 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Where are you trying to do this? In the markup or code-behind?
  #3 (permalink)  
Old March 2nd, 2004, 12:16 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , USA.
Posts: 1,111
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Try typing text first like 'as' in the table cell, then drop the control in between the 'a' and 's'.

  #4 (permalink)  
Old March 2nd, 2004, 05:31 PM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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

  #5 (permalink)  
Old March 2nd, 2004, 05:40 PM
Imar's Avatar
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 50%
Activity: 50% Activity: 50% Activity: 50%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

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.
  #6 (permalink)  
Old March 2nd, 2004, 06:03 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

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.
  #7 (permalink)  
Old March 2nd, 2004, 06:49 PM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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!

  #8 (permalink)  
Old March 8th, 2004, 03:28 PM
Registered User
 
Join Date: Jul 2003
Location: , , .
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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!

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Quick question put image in table cell user0b PHP How-To 0 June 26th, 2008 10:56 PM
How to put a button control in a GridView control ryan.webb ASP.NET 2.0 Basics 2 December 28th, 2007 05:26 AM
Add User Control to table cell in another UserCont veeruu ASP.NET 2.0 Professional 1 December 20th, 2006 06:22 AM
place anchor tag around bgImage inside cell?? mat41 HTML Code Clinic 4 January 26th, 2006 07:42 AM
How do I put this into a table? stacy Classic ASP Databases 3 February 3rd, 2004 07:52 AM



All times are GMT -4. The time now is 11:17 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.