Can a repeater's ItemTemplate instantiate derived classes?

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

  1. #1

    Default Can a repeater's ItemTemplate instantiate derived classes?

    I posted this in a different group yesterday with no responses, so I'll
    try here.

    I would like to have a repeater class like this:

    <asp:Repeater ID="CriteriaRepeater" runat="server" >
    <ItemTemplate>
    <uc1:BaseControl ID="BaseControl1" BindData='<%#
    Container.DataItem %>' runat="server" />
    </ItemTemplate>
    </asp:Repeater>

    The thing that is getting repeated for each item in the datasource is a

    user control that is a base class. I would like it to actually create
    different controls that are devired from the base control, depending on

    the values in the datasource. For example, if there are three classes
    derived from BaseControl1 (DerivedControl1, DerivedControl2,
    DerivedControl3), if the datasource has three records, the repeater
    would be able to create one instance of each of the derived classes
    rather than three instances of the base class. Is this possible?

    Thanks in advance,
    John

    Big Daddy Guest

  2. Similar Questions and Discussions

    1. #39713 [NEW]: Static variables defined in static methods duplicated in derived classes
      From: paul at digitalbacon dot us Operating system: Linux, Mac OS X 10.4, Windows XP PHP version: 5.2.0 PHP Bug Type: ...
    2. Problm with Repeater's ordering
      Hi! I have a Repeater, with a HTTPService dataProvider. The resulting XML has XML references (attached). The ordering of the data isn't the same...
    3. Design time support for classes derived from DataGridColumn
      How to get design time support for classes derived from DataGridColumn ? I have created new DataGridColumn type, it uses image from database as...
    4. exposing derived classes to proxy without fake webmethod?
      Hi, try using on the appropriate WebMethod. This attribute instructs the ASMX engine to include the type description for type bla. Cheers, --...
    5. Serializing classes derived from dataset
      Hi, I am trying to store various objects within session. Due to the site being hosted in a web farm we are going to have to use either State...
  3. #2

    Default Re: Can a repeater's ItemTemplate instantiate derived classes?

    "Big Daddy" <johngilmer@yahoo.com> wrote in message
    news:1161964037.400941.247310@m73g2000cwd.googlegr oups.com...
    >I posted this in a different group yesterday with no responses, so I'll
    > try here.
    >
    > I would like to have a repeater class like this:
    >
    > <asp:Repeater ID="CriteriaRepeater" runat="server" >
    > <ItemTemplate>
    > <uc1:BaseControl ID="BaseControl1" BindData='<%#
    > Container.DataItem %>' runat="server" />
    > </ItemTemplate>
    > </asp:Repeater>
    >
    > The thing that is getting repeated for each item in the datasource is a
    >
    > user control that is a base class. I would like it to actually create
    > different controls that are devired from the base control, depending on
    >
    > the values in the datasource. For example, if there are three classes
    > derived from BaseControl1 (DerivedControl1, DerivedControl2,
    > DerivedControl3), if the datasource has three records, the repeater
    > would be able to create one instance of each of the derived classes
    > rather than three instances of the base class. Is this possible?
    It's possible if you write it. ;-)

    You would need to create a composite control which decided on its child
    control(s) based on the data source. Put it inside of the repeater, data
    bind it, and you're all set.

    John


    John Saunders 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