Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3405140
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T05:28:08+00:00 2026-05-18T05:28:08+00:00

I was told to use a Repeater control in what I am doing which

  • 0

I was told to use a Repeater control in what I am doing which is a “Data Entry” screen with ASP.NET controls -a standard “address” like form. In cases, the fields on the form will repeated twice, once for the original values, one for the changed values. I have not used this control before but it seems like I have to bind to a database. Instead, I have an Entity object that has been obtained via a Repository. Can I bind to an object like this?

[DataContract()]
    public class RON
    {
        [DataMember]
        public string Id { get; set; }
        [DataMember]
        public string Comments { get; set; }

Then, I have my ASP.NET fields which I used the following with CSS to get the fields to line up. Can I put this in an ItemTemplate?

 <div class="row1">
    <div class="label">  
       ID: 
    </div>  
    <div class="value">
       <asp:Label ID="lblId" runat="server" />
    </div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T05:28:09+00:00Added an answer on May 18, 2026 at 5:28 am

    You will likely want to do something in your PageLoad such as:

    List<SomeBusinessObj> MyEntityCollection = Repository.Load();
    

    You then can bind your entity object collection to the repeater control using the DataSource property of the repeater control.

    rptrMyRepeater.DataSource = MyEntityCollection;
    

    Then by calling DataBind on that control, your collection will become bound to that control.

    rptrMyRepeater.DataBind();
    

    Then all you need to do is use the Repeater’s databound event to apply your custom properties to the repeater’s controls.

    protected void rptrExample_OnItemDataBound(object Sender, RepeaterItemEventArgs Args)
    {
     if (Args.Item.ItemType == ListItemType.Item || Args.Item.ItemType == ListItemType.AlternatingItem)
     {
      SomeBusinessObj Obj = (SomeBusinessObj)Args.Item.DataItem;
    
      Label LabelControl = (Label)Args.Item.FindControl("lblSomeLabel");
      LabelControl.Text = Obj.CustomProperty;
     }
    }
    

    The ItemDataBound event will be called for each row item, so each time it is called you will be working on the that row item’s controls and databound object.


    An alternative approach would be to directly databind within markup, not using the OnItemDataBound event.

    <asp:Label Text='<%# ((MyObjects.SomeBusinessObj)Container.DataItem).CustomProperty %>' runat="server" />
    

    The direct cast avoids the call into DataBinder.Eval, and the overhead of reflection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an ASP.NET page that's going to use Html controls to render a
Someplace I saw a snippet of code which told vi to use soft tabs
I know it's told to use table for tabular data, but I see in
i have been told to use 'when' statement to make multiplexer but not use
One of my friend told me Use font family: helvetica, arial, sans-serif in your
When I was using C++ in college, I was told to use multidimensional arrays
I've been told not to use for...in with arrays in JavaScript. Why not?
We have been told that we have to use a piece of software called
A sysadmin teacher told me one day that I should learn to use make
I have previously been told that I should always use Randomize() before I use

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.