Dynamic data in Repeater

Total Post:119

 1071  View(s)
Rate this:

in my webpage different users can visit same profile, but users can be either Owner of a profile, or Visitors, and content have to change for those two conditions.

if visitor check profile he see this editor:

<asp:Repeater id="UserLoginRepeater" runat="server">
           <asp:Label ID="Label2" runat="server">label Text</asp:Label> <asp:Label runat="server">label text 2</asp:Label>
            <asp:Button runat="server" Text="TestButton"/>
         <asp:Label ID="Label3" runat="server">Test</asp:Label>   <textarea><%# Eval("Content") %></textarea>


if User is Owner of a profile TextArea have to be replaced by a label and an other label with textbox have to be added.

What would be the best way to Load controls dynamicly into Repeater?

  1. Post:378

    Re: Dynamic data in Repeater

    Hi Goti, 

    Use a <asp:ContentPlaceholder> then in your code behind add a handler for the OnItemDataBound event. If you want those controls to handle events, make sure you bind your repeater before OnPreRender for the page.