[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

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!