Remy,
it is possible to have a variable represet a string array, but there
will need to be a bit of extra work on your side. if this property
will be hardcoded into the tag, you can build the property perhaps
during the AddParsedSubObject method of the page/control that contains
your custom control. ex:
<cc1:Something someAttrib="12,33,45,66,77,823,12"/>
this could be parsed into an int or string array during the
AddParsedSubObject method (or OnInit, or whatever...). you could even
provide a custom Set accessor for the property that exposes this array,
and parse the deliminated string there. easy answer though, you won't
be able to define on the frontend the contents of the array, you will
need a bit of manual work to make it an array.
Mike
Rémy Samulski wrote:
> Dear Mike,
>
> Thx for replying my question but I don't have any problems with sizing
> issues of a string array. What I'm trying to do is to make a custom
> control that can be set on design time in Visual Studio.net 2003.
> That's why I have chosen a String array and not for example an
> ArrayList (which can't be filled on design-time (one can only add
> Objects without filling the values). Everything works well except when
> I fill the String Array the HTML code of the concerned object is:
>
> <cc1:TabPages id="TabPages4" runat="server" MenuItems="String[]
> Array"></cc1:TabPages>
>
> The parser than (after saving and reopening the WebForm) throws an
> parser error stating it can't create an object of type
> 'System.String[]' from its string representation 'String[] Array' for
> the 'MenuItems' property.
>
> When I insert the
> (PersistenceMode(PersistenceMode.InnerDefaultPrope rty)) attribute in
> the code above (see first post) the HTML code changes to:
>
> <cc1:TabPages id="TabPages5" runat="server">
> <System.String Length="4"></System.String>
> <System.String Length="8"></System.String>
> </cc1:TabPages>
>
> But now the parser return the error: '' could not be set on property
> 'MenuItems'. Furthermore when I select the view HTML the HTML code
> shows the error: The active schema does not support the element
> 'System.String'.
>
> Anyone an example on how to implement an array property which can be
> edited on design time?
>
> Many thanks,
> Rémy
|