HighTechTalks DotNet Forums  

Re: Custom Control - Designer

ASP.net Building Controls microsoft.public.dotnet.framework.aspnet.buildingcontrols


Discuss Re: Custom Control - Designer in the ASP.net Building Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Thomas Hansen
 
Posts: n/a

Default Re: Custom Control - Designer - 01-25-2007 , 04:17 PM








On Jan 24, 6:59 pm, Simon <S... (AT) discussions (DOT) microsoft.com> wrote:
Quote:
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://ajaxwidgets.com
Free ASP.NET Ajax Widgets NOW!



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.