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]" <> wrote in message
news:#...
> 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" <> wrote in message
> news:%...
> > 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?
> >
> >
> >
> >
>
>