Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Can a repeater's ItemTemplate instantiate derived classes?

Reply
Thread Tools

Can a repeater's ItemTemplate instantiate derived classes?

 
 
Big Daddy
Guest
Posts: n/a
 
      10-27-2006
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

 
Reply With Quote
 
 
 
 
John Saunders
Guest
Posts: n/a
 
      10-28-2006
"Big Daddy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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


 
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
Derived::Derived(const Base&) and Derived& operator=(const Base&) developereo@hotmail.com C++ 1 05-23-2007 01:44 PM
Derived::Derived(const Base&) developereo@hotmail.com C++ 4 05-23-2007 09:32 AM
Derived::Derived(const Base&) and Derived& operator=(const Base&) developereo@hotmail.com C++ 1 05-23-2007 12:07 AM
Can a repeater's ItemTemplate instantiate derived classes? Big Daddy ASP .Net Web Controls 1 10-29-2006 09:23 PM
can code inside a Repeater's ItemTemplate modify controls in the ItemTemplate? Bennett Haselton ASP .Net 1 09-24-2004 01:59 AM



Advertisments