server control collection with several types of properties

Ask a Question related to ASP.NET Building Controls, Design and Development.

  1. #1

    Default server control collection with several types of properties

    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.
    mr dropdown Guest

  2. Similar Questions and Discussions

    1. Collection Property of Another Custom Server Control
      Hi, I read more and figured out how to build what I needed: <cc> <item></item> <item></item> </cc> when <item> is an editable control in...
    2. server control with collection
      Hello, I wrote a simple server control from a sample I found on the web in the following URL: http://west-wind.com/weblog/posts/200.aspx The...
    3. Server Control using a Collection
      Ok I am brand new at C#. I am attempting to build a server control that contains a collection. Trouble is when I place my control on my page and...
    4. Server Control Collection Properties Solutions,Problems MVP Advice Requested
      I have solved most of my Server Control Collection property issues. I wrote an HTML page that describes all of the problems that I have encountered...
    5. Multiple Collection Properties in a Custom Control
      I am attempting to create control with 2 collection properties that are persisted with mode PersistenceMode.InnerProperty. When I create the...
  3. #2

    Default Re: server control collection with several types of properties

    mr. dropdown,
    yes this is possible. you need to investigate the ControlBuilder
    class:


    [url]http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuicontrolbuilderclasstopic.asp[/url]

    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:

    [url]http://groups.google.com/group/microsoft.public.dotnet.framework.aspnet.webcontro ls/browse_thread/thread/5c1776d37f63af2b/1b67c98bae515c20?lnk=st&q=controlbuilder&rnum=2#1b 67c98bae515c20[/url]

    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.
    Mike MacMillan Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139