Home > DeveloperSection > Forums > Dynamic data in Repeater
Goti Bandu

Total Post:119

Posted on    August-28-2014 1:12 AM


 1 Reply(s)
 596  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?

Sumit Kesarwani

Total Post:378

Posted on    August-28-2014 2:10 AM

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.

Don't want to miss updates? Please click the below button!

Follow MindStick