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 6768027
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:01:24+00:00 2026-05-26T15:01:24+00:00

For example in the backend I’m binding a datable to a repeater and in

  • 0

For example in the backend I’m binding a datable to a repeater and in the front end I’m setting up my repeater as such:

<asp:Repeater ID="Repeater1" runat="server" onitemdatabound="Repeater1_ItemDataBound">
   <ItemTemplate>
     <div class="user">
         Name:   <%# DataBinder.Eval(Container, "DataItem.Name")%>
         Email:  <%# DataBinder.Eval(Container, "DataItem.Email")%>
         Active: <%# DataBinder.Eval(Container, "DataItem.Active")%>
         Status: <%# DataBinder.Eval(Container, "DataItem.Status")%>
     </div>
    </ItemTemplate>
</asp:Repeater>

So the output for “name” and “email” are fine. However “Active” and “Status” print out an integer code that I would like to change to a more descriptive string based on a reference table I have.

I’m guessing I can do this on the “ItemDataBound” event of the repeater, but I’m stuck on what my next step should be, namely checking the two fields that I need to modify and change them.

protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
    if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
    {
        //Do modifications here
    }
}
  • 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-26T15:01:26+00:00Added an answer on May 26, 2026 at 3:01 pm

    You can either

    1. Handle the formatting in the ItemDataBound event
    2. Create public methods in your Page or WebUserControl class to handle the formatting.

    Using option 1 will require you to declare a control such as a label to store the value for each field like so:

    <asp:Repeater ID="Repeater1" runat="server" onitemdatabound="Repeater1_ItemDataBound">
       <ItemTemplate>
         <div class="user">
                 <asp:Label ID="ActiveLabel" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Name")%>'></asp:Label>
         </div>
        </ItemTemplate>
    </asp:Repeater>
    

    Then in your ItemDataBound event you can find the control and set its value as required.

    protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
    
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
                Label activeLabel = (Label)e.Item.FindControl("ActiveLabel");
    
                //Format label text as required
        }
    }
    

    Using option 2 will require you to create a server side publicly accessible method which you can call like so:

    <asp:Repeater ID="Repeater1" runat="server" onitemdatabound="Repeater1_ItemDataBound">
       <ItemTemplate>
         <div class="user">
         Active: <%# FormatActive((string)DataBinder.Eval(Container, "DataItem.Active")) %>
         </div>
        </ItemTemplate>
    </asp:Repeater>
    

    Then define a method like so:

    public string FormatActive(string input)
    {
         //Format as required
         //Return formatted string
    }
    
    • 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 MVC 3 application with a SQL Server 2005 database backend.
I have a C# front end and a C++ backend for performance reasons. Now
I have a website that consists of 2 applications: Front end application Backend application
My php is weak and I'm trying to change this string: http://www.example.com/backend.php?/c=crud&m=index&t=care ^ to
I have one server located at example.com running apache, serving my static html files.
Given the following example: class AnonymousSession << Struct.new(:location, :preferences) def valid? ... end def
we are developing a database backend for a multiplayer game. The server is written
we are developing a database backend for a multiplayer game. The server is written
I have a Silverlight application that communications with an ASP.NET backend through WCF. I
I've been thinking of writing a Backend-End Admin Generator for a while now. But

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.