Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
microsoft.public.dotnet.framework.aspnet.buildingcontrols
Re: Custom Control - Designer
Thomas Hansen
1/25/2007 9:17:00 PM
On Jan 24, 6:59 pm, Simon <S...@discussions.microsoft.com> wrote:
> How can I make the TextBox's that my control generates based on the
> parameters visible to the designer so someone can do something such as:
> Text1.Text in the postback codebehind?
You expose it as a property in your control class and it should be
possible to set and get members from it both in code and in the WYSIWYG
designer.
No magic, or should I say "all magic" ;)
You can even set the "Description" and the DefaultValue etc...
Like this:
[Description("Defines if the DateTimePicker also has the possibility to
choose the Time in addition to the date")]
[DefaultValue(false)]
[Category("DateTimePicker custom properties")]
Normally you'd NOT store the actually VALUE in a private data field but
rather stuff it into the ViewState like this:
public bool HasTimePart
{
get
{
if (ViewState["HasTimePart"] == null)
return false;
return (bool)ViewState["HasTimePart"];
}
set
{
ViewState["HasTimePart"] = value;
}
}
Of importance is that you return the same value as you have declared
your "DefaultValue" attribute to be of...
..t
--
http://ajaxw...
Free ASP.NET Ajax Widgets NOW!
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: Custom Control - Designer
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password