Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > server control collection with several types of properties

Reply
Thread Tools

server control collection with several types of properties

 
 
mr dropdown
Guest
Posts: n/a
 
      12-25-2005
Is it possible to implement a server control that will look like this:
<just:control>
<columns>
<columnTypeA id=1></columnTypeA>
<columnTypeA id=2></columnTypeA>
<columnTypeB id=3></columnTypeB>
<columnTypeB id=4></columnTypeB>
</columns>
</just:control>

While columnTypeA is a collection and columnTypeB is a different collection?
Another option is that both tags will be in the same collection (if
possible..)
Thanks.
 
Reply With Quote
 
 
 
 
Mike MacMillan
Guest
Posts: n/a
 
      12-28-2005
mr. dropdown,
yes this is possible. you need to investigate the ControlBuilder
class:


http://msdn.microsoft.com/library/de...classtopic.asp

as this will show you how to parse custom html into strongly typed
classes. basically, your just:control class will have a ControlBuilder
attached to it via attributes, ex:

namespace Just {
[ControlBuilder(typeof(JustControlBuilder))]
public class SomeControl : Control {
}
}

first you'll need to build a class that extends the ControlBuilder
class (JustControlBuilder in the above example). this class has 2
methods you need to worry about; GetChildControlType and
AppendLiteralString. before Control.AddParsedSubObject is called,
SomeControl (above) will call GetChildControlType from your control
builder, passing the tagname of the html tag its parsing. basically,
if its a tag you're looking for you return the type of the class it
represents (see below). AppendLiteralString controls whether literal
text within your control's boundries will be handled or not.
next, you'll need a class (extends control) to represent each of the
items in the dropdown. per your description, you'd basically need 3
classes; one generic dropdown item class, and 2 collection classes to
represt itemA and itemB (perhaps one base class both can derive
from...).
each of the associated child controls can have their own control
builders to further parse nested html. the functionality is up to you
to implement...get as detailed as you'd like.
here's a link to someone who was having a similar issue (parsing
nested html), and their resolution:

http://groups.google.com/group/micro...67c98bae515c20

hope this helps,
Mike MacMillan


mr dropdown wrote:
> Is it possible to implement a server control that will look like this:
> <just:control>
> <columns>
> <columnTypeA id=1></columnTypeA>
> <columnTypeA id=2></columnTypeA>
> <columnTypeB id=3></columnTypeB>
> <columnTypeB id=4></columnTypeB>
> </columns>
> </just:control>
>
> While columnTypeA is a collection and columnTypeB is a different collection?
> Another option is that both tags will be in the same collection (if
> possible..)
> Thanks.


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Collection problems (create Collection object, add data to collection, bind collection to datagrid) Řyvind Isaksen ASP .Net 1 05-18-2007 09:24 AM
RDOC: several related modules in several C files Victor \Zverok\ Shepelev Ruby 3 03-16-2007 04:15 PM
how can I create a properties collection for a user control news_server.nc.rr.com ASP .Net 0 05-24-2005 08:13 PM
how can I create a properties collection for a user control news_server.nc.rr.com ASP .Net Web Controls 0 05-24-2005 08:13 PM
Server Control Collection Properties Solutions,Problems MVP Advice Requested Brian ASP .Net 2 05-28-2004 02:26 PM



Advertisments