473,776 Members | 1,645 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.W ebControls.Tabl e.

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:

[TestTableContro l "TestTableContr ol1"]
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.W ebControls;
using System.Componen tModel;
using System.Collecti ons;
namespace StyleLibFunctio ns
{
#region TestTableContro l

[ToolboxData("<{ 0}:TestTableCon trol
runat=server></{0}:TestTableCo ntrol>")]
public class TestTableContro l: WebControl
{
#region Variable Declaration

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

#endregion Variable Declaration

#region Overridden Properties
public override ControlCollecti on Controls
{
get
{
EnsureChildCont rols();
return base.Controls;
}
}
#endregion Overridden Properties

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

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

_tr.Cells.Add(_ td);
_table.Rows.Add (_tr);

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

}
protected override void Render(HtmlText Writer writer)
{
_table.RenderCo ntrol(writer);
}
#endregion Overridden Methods
}
#endregion
}
Nov 17 '05 #1
0 2011

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

Similar topics

19
2989
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 provide an open TD with a DIV in it for the content of this formlet. (The DIV is for DHTML to hide and show the content) I've created a web page showing step by step the two problems I'm encountering. This problem is much easier to see than it...
2
3921
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 javascript checks for things like valid e-mail addresses or phone numbers (without having to add a separate control for validation). One idea I did some work on was having the control implement the IValidator interface and basically recreating...
5
4091
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 the child controls appear in the property inspector as sub-properties of the main control and can be manipulated as normal at design time. If any of the properties of the parent (main) control are changed at design time the composite control is...
2
1480
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 the page, but it depends on other Web Form controls inside it but I do not know how to add the other web form controls such as a XML web form control into this programatticly created control. thanks
0
771
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). However, I want to add the control to my global assembly cache. No problem there, until I try to use it. If I specify the Register directive as follows:
1
1546
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 below. Now what I want is when the button is clicked I wish to catch the event (this is happening correctly) and then raise the event "MyCustomEvent". "MyCustomEvent" is raise in the event "btn_Click" (at bottom of email)
0
1549
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
3007
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 lifecycle of a page with a custom composite control on it. You can find that document here: http://www.ats-engineers.com/lifecycle.htm
6
2633
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 control implement INamingContainer? In this moment I am working on a custom control that is composed by a
0
9464
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10289
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10120
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7471
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6722
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5493
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4031
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3622
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2860
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.