exposing NameValueCollection Property through ASPX page ? (string representation of its values)

S

sonic

Hi,

Is there a signature that would allow me to set values for such
properties as NameValueCollection or StringList within ASPX xml
definition ?

example:

myControl has a Values property of type NameValueCollection.
class myControl {
public NameValueCollection Values {...}
}

could i do something like this ?
--main.aspx--
<ctrl:myControl id="..." Values="Name1,Val1--Name2,Val2--" ..>
etc.

I attempt some guess signature that may work, but i get following
errror:
Cannot create an object of type
'System.Collections.Specialized.NameValueCollection' from its string
representation 'H,S' for the 'Values' property.

which leads me to believe that it may be possible to represet this
property as string.
 
J

John Saunders

sonic said:
Hi,

Is there a signature that would allow me to set values for such
properties as NameValueCollection or StringList within ASPX xml
definition ?

example:

myControl has a Values property of type NameValueCollection.
class myControl {
public NameValueCollection Values {...}
}

could i do something like this ?
--main.aspx--
<ctrl:myControl id="..." Values="Name1,Val1--Name2,Val2--" ..>
etc.

I attempt some guess signature that may work, but i get following
errror:
Cannot create an object of type
'System.Collections.Specialized.NameValueCollection' from its string
representation 'H,S' for the 'Values' property.

which leads me to believe that it may be possible to represet this
property as string.

You'll need a custom type converter which can convert to and from a string
representation. Look up "type converter" on MSDN.

John Saunders
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top