473,383 Members | 1,896 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,383 software developers and data experts.

Problem with composite control

I am trying to create my first composite control.

Here is the code:

using System;

using System.Collections;

using System.ComponentModel;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace CompositeControls

{

[ToolboxData("<{0}:LabelMaskEdit runat=server></{0}:InteractiveSearchBox>")]

public class LabelMaskEdit : Table, INamingContainer

{

protected Label LabelName = new Label();

protected Infragistics.WebUI.WebDataInput.WebMaskEdit SearchTextBox = new
Infragistics.WebUI.WebDataInput.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 1710
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 CreateChildControls 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********@comcast.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I am trying to create my first composite control.

Here is the code:

using System;

using System.Collections;

using System.ComponentModel;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace CompositeControls

{

[ToolboxData("<{0}:LabelMaskEdit runat=server></{0}:InteractiveSearchBox>")]
public class LabelMaskEdit : Table, INamingContainer

{

protected Label LabelName = new Label();

protected Infragistics.WebUI.WebDataInput.WebMaskEdit SearchTextBox = new
Infragistics.WebUI.WebDataInput.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.WebControls;

using System.ComponentModel;

using Infragistics.WebUI.WebDataInput;

namespace WebControlLib

{

/// <summary>

/// Summary description for WebCustomControl1.

/// </summary>

[DefaultProperty("Text"),

ToolboxData("<{0}:LabelMaskEdit runat=server></{0}:LabelMaskEdit>")]

public class LabelMaskEdit : System.Web.UI.WebControls.WebControl

{

private Label label;

private WebMaskEdit textBox;

[Bindable(true), Category("Appearance"), DefaultValue("")]

public string LabelText

{

get

{

EnsureChildControls();

return label.Text;

}

set

{

EnsureChildControls();

label.Text = value;

}

}

[Bindable(true), Category("Appearance"), DefaultValue("")]

public string Text

{

get

{

EnsureChildControls();

return textBox.Text;

}

set

{

EnsureChildControls();

textBox.Text = value;

}

}

protected override void CreateChildControls()

{

label = new Label();

this.Controls.Add(label);

textBox = new WebMaskEdit();

this.Controls.Add(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*@NOobiesSPAM.com> wrote in message
news:#z*************@TK2MSFTNGP11.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 CreateChildControls 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********@comcast.net> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I am trying to create my first composite control.

Here is the code:

using System;

using System.Collections;

using System.ComponentModel;

using System.Web.UI;

using System.Web.UI.WebControls;

namespace CompositeControls

{

[ToolboxData("<{0}:LabelMaskEdit

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

public class LabelMaskEdit : Table, INamingContainer

{

protected Label LabelName = new Label();

protected Infragistics.WebUI.WebDataInput.WebMaskEdit SearchTextBox = new Infragistics.WebUI.WebDataInput.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
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...
5
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...
5
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...
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...
3
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...
10
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...
9
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...
1
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...
1
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...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...

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.