473,785 Members | 2,289 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with composite control

I am trying to create my first composite control.

Here is the code:

using System;

using System.Collecti ons;

using System.Componen tModel;

using System.Web.UI;

using System.Web.UI.W ebControls;

namespace CompositeContro ls

{

[ToolboxData("<{ 0}:LabelMaskEdi t runat=server></{0}:Interactive SearchBox>")]

public class LabelMaskEdit : Table, INamingContaine r

{

protected Label LabelName = new Label();

protected Infragistics.We bUI.WebDataInpu t.WebMaskEdit SearchTextBox = new
Infragistics.We bUI.WebDataInpu t.WebMaskEdit() ;
}

}

After I complied the control I can add it to Toolbar with no problem but
when I add the control from Toolbar to aspx page I see a box with "Error
creating control ..."

Can someone help, please?


Nov 18 '05 #1
2 1736
Hi Mark,

If you move the cursor over the error message you should get a tooltip with
a more specific error message, please post that message to help the guessing
game.

Also note that children controls of a composite control should always be
created in an overriden CreateChildCont rols methods and not when declaring
the fields as you are doing.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
My profile: http://aspnet2.com/mvp.ashx?vga
"Mark Goldin" <ma********@com cast.net> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
I am trying to create my first composite control.

Here is the code:

using System;

using System.Collecti ons;

using System.Componen tModel;

using System.Web.UI;

using System.Web.UI.W ebControls;

namespace CompositeContro ls

{

[ToolboxData("<{ 0}:LabelMaskEdi t runat=server></{0}:Interactive SearchBox>")]
public class LabelMaskEdit : Table, INamingContaine r

{

protected Label LabelName = new Label();

protected Infragistics.We bUI.WebDataInpu t.WebMaskEdit SearchTextBox = new
Infragistics.We bUI.WebDataInpu t.WebMaskEdit() ;
}

}

After I complied the control I can add it to Toolbar with no problem but
when I add the control from Toolbar to aspx page I see a box with "Error
creating control ..."

Can someone help, please?

Nov 18 '05 #2
I have this code now:
using System;

using System.Web.UI;

using System.Web.UI.W ebControls;

using System.Componen tModel;

using Infragistics.We bUI.WebDataInpu t;

namespace WebControlLib

{

/// <summary>

/// Summary description for WebCustomContro l1.

/// </summary>

[DefaultProperty ("Text"),

ToolboxData("<{ 0}:LabelMaskEdi t runat=server></{0}:LabelMaskEd it>")]

public class LabelMaskEdit : System.Web.UI.W ebControls.WebC ontrol

{

private Label label;

private WebMaskEdit textBox;

[Bindable(true), Category("Appea rance"), DefaultValue("" )]

public string LabelText

{

get

{

EnsureChildCont rols();

return label.Text;

}

set

{

EnsureChildCont rols();

label.Text = value;

}

}

[Bindable(true), Category("Appea rance"), DefaultValue("" )]

public string Text

{

get

{

EnsureChildCont rols();

return textBox.Text;

}

set

{

EnsureChildCont rols();

textBox.Text = value;

}

}

protected override void CreateChildCont rols()

{

label = new Label();

this.Controls.A dd(label);

textBox = new WebMaskEdit();

this.Controls.A dd(textBox);

}

}

}

It does not give me an error when I drop it on a form.
But I am not getting to much of my control either.
All I see is a label that I cannot assign a text to.
I dont see a text box at all.
What I want is to see text box with all its properties in a property window.
For a label just a text is fine.
How can I do that?
Also when I change something in my customcontrol do I need to remove it
from the form and drop on it again? (Not what I would expect).

Thanks much for help.

"Victor Garcia Aprea [MVP]" <vg*@NOobiesSPA M.com> wrote in message
news:#z******** *****@TK2MSFTNG P11.phx.gbl...
Hi Mark,

If you move the cursor over the error message you should get a tooltip with a more specific error message, please post that message to help the guessing game.

Also note that children controls of a composite control should always be
created in an overriden CreateChildCont rols methods and not when declaring
the fields as you are doing.

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx
My profile: http://aspnet2.com/mvp.ashx?vga
"Mark Goldin" <ma********@com cast.net> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
I am trying to create my first composite control.

Here is the code:

using System;

using System.Collecti ons;

using System.Componen tModel;

using System.Web.UI;

using System.Web.UI.W ebControls;

namespace CompositeContro ls

{

[ToolboxData("<{ 0}:LabelMaskEdi t

runat=server></{0}:Interactive SearchBox>")]

public class LabelMaskEdit : Table, INamingContaine r

{

protected Label LabelName = new Label();

protected Infragistics.We bUI.WebDataInpu t.WebMaskEdit SearchTextBox = new Infragistics.We bUI.WebDataInpu t.WebMaskEdit() ;
}

}

After I complied the control I can add it to Toolbar with no problem but
when I add the control from Toolbar to aspx page I see a box with "Error
creating control ..."

Can someone help, please?


Nov 18 '05 #3

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

Similar topics

0
1587
by: Satya Bojanapally | last post by:
Hi, I am unable to add a pager for this composite control. I had created a composite control in C#. The control is having 5 labels, one radio button and one DropDownList control. The composite control should display 2 columns and 2 rows per page. I am able to display 4 Composite Controls independently, when the user is changing the index of the DropDownList control, automatcially the output should get reflected on the composite control...
5
1291
by: Philip Townsend | last post by:
I have built a composite control containing a calendar, two dropdownlists, and a button. Currently I have only the index of each control as a means of formatting. What is the normal way of formatting the layout of the controls in a composite control? Thanks! *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it!
5
2011
by: KJ | last post by:
This is kind of hard to explain but I have a The controls are created with CreateChildControls(). Now let say I click a button and an error occurs in the control. If I throw it up it goes back to the web form. where do I catch the exception at? Example Webform Composite Control
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...
3
2270
by: Eric | last post by:
I have built a composite user web control that I want to create dynamically. The form will contain a variable number of these controls and as well some of the contents of the user web control itself are dynamically created controls. I create as follows: wcGroupControl oGroupControl = new wcGroupControl(); I then tried calling methods of the control passing dynamic controls as parameters that need to be added to the web controls on the...
10
2326
by: dx | last post by:
I have the Microsoft Press: Developing Microsoft ASP.NET Server Controls and Components book. It's starting to shine some light on control development but there is something about composite controls that I don't understand... I've included a snippet from Chapter 12 below on Composite Controls: <start> Override the CreateChildControls method to instantiate child controls, initialize them, and add them to the control tree. Do not perform...
9
1529
by: Alphonse Giambrone | last post by:
I have built a simple composite control that consists of a textbox, requiredfieldvalidator and rangevalidator. For properties that are unique to the individual control, I set/get them directly from the control as follows: public string Text { get {
1
1318
by: Jeff | last post by:
Hi - I am developing a composite control using VB.NET. In the ASP.NET page using the control, How can I update a label text value to reflect the value of a property of the custom control whenever the composite control is changed? The label is not a part of the custom control. I've managed to correctly set the composite control properties whenever it
1
1128
by: Charlie | last post by:
Hi: I'm creating some composite custom server controls that combine user interface element and a validation control. One such control combines a dropdownlist and required field validator. The problem is when I want to use it on a form, how do I get a reference to the dropdownlist contained within the control to call databind method? Also, if I call databind within server control, it works but viewstate doesn't work. Does any know of...
0
9647
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9489
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
9959
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7509
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
6744
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
5528
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4063
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
3
2893
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.