PC Review


Reply
Thread Tools Rate Thread

Using Table control in a custom composite control. Control does not render properly in design time.

 
 
jb_in_marietta@yahoo.com
Guest
Posts: n/a
 
      1st Jul 2003
All,

I have written a very simple custom composite control that includes a
control of type System.Web.UI.WebControls.Table.

The control renders fine in run time, but for some reason, it does not
render properly in design time.

In design time it renders something like this:

[TestTableControl "TestTableControl1"]


Could someone please explain why this control does not render in
design time.
(complete code is included below)

Thanks in advance!!!

--Jonathan

------------------------------------------------------------------------------


using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.Collections;


namespace StyleLibFunctions
{
#region TestTableControl

[ToolboxData("<{0}:TestTableControl
runat=server></{0}:TestTableControl>")]
public class TestTableControl: WebControl
{
#region Variable Declaration

private Table _table;
private TableRow _tr;
private TableCell _td;

#endregion Variable Declaration

#region Overridden Properties
public override ControlCollection Controls
{
get
{
EnsureChildControls();
return base.Controls;
}
}
#endregion Overridden Properties

#region Overridden Methods
protected override void CreateChildControls ()
{
//clear controls
Controls.Clear();

//Create a Table object
_table = new Table();
_tr = new TableRow();
_td = new TableCell();
_td.Controls.Add(new LiteralControl("Cell Content"));

_tr.Cells.Add(_td);
_table.Rows.Add(_tr);

//add table to control tree
Controls.Add (_table);

}
protected override void Render(HtmlTextWriter writer)
{
_table.RenderControl(writer);
}
#endregion Overridden Methods
}
#endregion
}
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IE6 doesnt render the page properly whereas IE7 does =?Utf-8?B?QWxleCBGaW1pbmU=?= Microsoft ASP .NET 2 31st Aug 2007 03:15 PM
Composite control with custom control Frédéric Mayot Microsoft ASP .NET 0 27th Jul 2004 07:52 AM
Page.Render do not render complete page Lau Lei Cheong Microsoft ASP .NET 1 15th May 2004 05:10 AM
Composite control with dynamic composite controls sleigh Microsoft ASP .NET 1 12th Feb 2004 07:24 PM
Design time rendering of a composite custom web control Barry Carr Microsoft ASP .NET 4 15th Jan 2004 10:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:13 PM.