473,395 Members | 2,222 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

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
}
Nov 17 '05 #1
0 1993

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

19
by: Dales | last post by:
I have a custom control that builds what we refer to as "Formlets" around some content in a page. These are basically content "wrapper" sections that are tables that have a colored header and...
2
by: Pham Nguyen | last post by:
Has anyone seen an example of a textbox server control that has built-in client-side validation? I'd like to build a server control that extends the System.Web.UI.WebControls.TextBox class to allow...
5
by: Barry Carr | last post by:
Hi, I've created a composite custom web control and a ControlDesigner descendant to render the control a design time. The child controls are public properties of composite control and as such...
2
by: Brian Henry | last post by:
I want to create a web custom control (not a user web control) that I can add a XML translation control into, how would I do this? I am using the web custom control as a template that I can add to...
0
by: SA | last post by:
Hi all, I have developed a custom web control that inherits from the WebControl base class. I have also added a designer so that there is some design-time information in VS.NET (2003). ...
1
by: Martin | last post by:
Hi, I have been having trouble rasing events in my custom (composite) server controls. To demonstate my problem I put a small control together with a single button on it and included the code...
0
by: Pavan | last post by:
My name is Pavan and I am a software engineer working on ASP .Net web development. Currently I am using .Net 2.0 Professional Edition to develop my web pages. I have a problem
3
by: Beavis | last post by:
I hate to repost a message, but I am still at the same point where I was when I originally posted, and hopefully someone else will see this one... Ok, so I have gone off and documented the...
6
by: shapper | last post by:
Hello, I am working in a class library with various custom controls. In which cases should a control inherit Control, WebControl and CompositeControl classes? And when should a custom...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.