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

  • Home
  • SEARCH
  • 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 45341
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T15:47:37+00:00 2026-05-10T15:47:37+00:00

This is an ASP.Net 2.0 web app. The Item template looks like this, for

  • 0

This is an ASP.Net 2.0 web app. The Item template looks like this, for reference:

<ItemTemplate>   <tr>     <td class='class1' align=center><a href='url'><img src='img.gif'></a></td>     <td class='class1'><%# DataBinder.Eval(Container.DataItem,'field1') %></td>     <td class='class1'><%# DataBinder.Eval(Container.DataItem,'field2') %></td>     <td class='class1'><%# DataBinder.Eval(Container.DataItem,'field3') %></td>     <td class='class1'><%# DataBinder.Eval(Container.DataItem,'field4') %></td>   </tr> </ItemTemplate> 

Using this in codebehind:

foreach (RepeaterItem item in rptrFollowupSummary.Items) {     string val = ((DataBoundLiteralControl)item.Controls[0]).Text;     Trace.Write(val); } 

I produce this:

<tr>   <td class='class1' align=center><a href='url'><img src='img.gif'></a></td>   <td class='class1'>23</td>   <td class='class1'>1/1/2000</td>   <td class='class1'>-2</td>   <td class='class1'>11</td> </tr> 

What I need is the data from Field1 and Field4

I can’t seem to get at the data the way I would in say a DataList or a GridView, and I can’t seem to come up with anything else on Google or quickly leverage this one to do what I want. The only way I can see to get at the data is going to be using a regex to go and get it (Because a man takes what he wants. He takes it all. And I’m a man, aren’t I? Aren’t I?).

Am I on the right track (not looking for the specific regex to do this; forging that might be a followup question 😉 ), or am I missing something?


The Repeater in this case is set in stone so I can’t switch to something more elegant. Once upon a time I did something similar to what Alison Zhou suggested using DataLists, but it’s been some time (2+ years) and I just completely forgot about doing it this way. Yeesh, talk about overlooking something obvious. . .

So I did as Alison suggested and it works fine. I don’t think the viewstate is an issue here, even though this repeater can get dozens of rows. I can’t really speak to the question if doing it that way versus using the instead (but that seems like a fine solution to me otherwise). Obviously the latter is less of a viewstate footprint, but I’m not experienced enough to say when one approach might be preferrable to another without an extreme example in front of me. Alison, one question: why literals and not labels?

Euro Micelli, I was trying to avoid a return trip to the database. Since I’m still a little green relative to the rest of the development world, I admit I don’t necessarily have a good grasp of how many database trips is ‘just right’. There wouldn’t be a performance issue here (I know the app’s load enough to know this), but I suppose I was trying to avoid it out of habit, since my boss tends to emphasize fewer trips where possible.

  • 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. 2026-05-10T15:47:38+00:00Added an answer on May 10, 2026 at 3:47 pm

    Off the top of my head, you can try something like this:

    <ItemTemplate>   <tr>     <td 'class1'><asp:Literal ID='litField1' runat='server' Text='<%# Bind('Field1') %>'/></td>     <td 'class1'><asp:Literal ID='litField2' runat='server' Text='<%# Bind('Field2') %>'/></td>     <td 'class1'><asp:Literal ID='litField3' runat='server' Text='<%# Bind('Field3') %>'/></td>     <td 'class1'><asp:Literal ID='litField4' runat='server' Text='<%# Bind('Field4') %>'/></td>   </tr> </ItemTemplate> 

    Then, in your code behind, you can access each Literal control as follows:

    foreach (RepeaterItem item in rptrFollowupSummary.Items) {        Literal lit1 = (Literal)item.FindControl('litField1');     string value1 = lit1.Text;     Literal lit4 = (Literal)item.FindControl('litField4');     string value4 = lit4.Text; } 

    This will add to your ViewState but it makes it easy to find your controls.

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

Sidebar

Ask A Question

Stats

  • Questions 81k
  • Answers 81k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I recommend IronPython -- among its advantages is the excellent… May 11, 2026 at 4:32 pm
  • Editorial Team
    Editorial Team added an answer default_url_options is available from config.action_mailer and should be set in… May 11, 2026 at 4:32 pm
  • Editorial Team
    Editorial Team added an answer I solved my problem. Seems i was using the wrong… May 11, 2026 at 4:32 pm

Related Questions

I have a DropDownList inside an UpdatePanel that is populated on postback from a
I have an ASP.NET 2.0 web app and part of the structure still has
I have a asp.net 2.0 web app which calls a long running stored proc
I'm a total newbie to SVN and haven't been able to find an answer

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.