prevents serializing them to the aspx source. However, I have a hunch that
how to persist them. I might be wrong with that one though. If this doesn't
purpose. If you are interested in that approach, you could check my article:
"Evgeni Presmann" <Evgeni.Presmann@sdx-ag.de> wrote in message
news:utzM69MVDHA.2192@TK2MSFTNGP10.phx.gbl...
> Hello Teemu,
>
> Thank you for this suggestion, but unfortunately it doesn't work. At
> design-time after the compilation and at run-time the parameters still
> disappear. I suppose, that I've don't declare some attributes for the
class
> or property to right serialize them, but I've no idea which attibutes must
> be needed
>
> Regards,
>
> Evgeni
>
> "Teemu Keiski" <joteke@aspalliance.com> schrieb im Newsbeitrag
> news:ebPP9A2UDHA.2164@TK2MSFTNGP10.phx.gbl...
> > When values are set at design-time, they are specified declaratively in
> the
> > aspx and therefore set for control's properties on every request. If you
> > want the property to be able to persist/preserve values so that setting
is
> > done programmatically in the code and value cab ge get sometime later
> (even
> > on some other postback), you could put the properties to use ViewState.
> That
> > is change the property something like this:
> >
> > public string[] Parameters
> > {
> > get {
> > object o=ViewState["parameters"];
> > return (o==null)? new string[]{} : (string[])o;
> > }
> > set
> > {
> > ViewState["parameters"] = value;
> > }
> > }
> >
> > --
> > Teemu Keiski
> > MCP, Designer/Developer
> > Mansoft tietotekniikka Oy
> >
http://www.mansoft.fi > >
> > AspInsiders Member,
www.aspinsiders.com > > ASP.NET Forums Moderator,
www.asp.net > > AspAlliance Columnist,
www.aspalliance.com > >
> > "Evgeni Presmann" <Evgeni.Presmann@sdx-ag.de> wrote in message
> > news:Ol4p2YpUDHA.1812@TK2MSFTNGP11.phx.gbl...
> > > Hello all,
> > > I've defined a custom control with the property of type string[].
> > > If I assigned values to the property at design time, I can see these
> > values
> > > in the control as expected. However if I compiled the application, all
> the
> > > values disappear.
> > >
> > > Help please
> > >
> > > Regards,
> > > Evgeni
> > >
> > > public class MediaElement : WebControl
> > > {
> > > private string[] parameters = null;
> > >
> > >
> [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
> > > public string[] Parameters
> > > {
> > > get { return this.parameters; }
> > > set { this.parameters = value; }
> > > }
> > > protected override void Render(HtmlTextWriter output)
> > > {
> > > if (this.parameters != null)
> > > foreach (string parameter in this.parameters)
> > > output.Write(parameter + " ");
> > > else
> > > output.Write( "empty list");
> > > }
> > > }
> > >
> > >
> >
> >
>
>