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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:25:54+00:00 2026-05-24T07:25:54+00:00

I have a property in my code that sends back the information in a

  • 0

I have a property in my code that sends back the information in a usercontrol that is a repeater. rptOwners is the repeater I am using. The information inside the repeater has to be parsed manually to xml and sent back through a property in the code. The problem is that I can’t seem to get access to the values of the controls inside the repeater.

When debugging, I am able to see that there are the 2 items I expected in rptOwners.DataSource and that the rptOwners.Items.Count = 2. I can then see in the watch window that the information I want is there but I can’t get access to it.

I have been trying rptOwners.DataSource[0].Name etc but it says that “cannot apply indexing to an expression of type object.

public string xmlString
{
    get
    {
        var _builder = new StringBuilder();

        var rpt = rptOwners.DataSource;
        IList<string> ownersRepeater = new List<string>();

        foreach (var item in rpt )
        {
            _builder.Append("<Owners>");
            _builder.Append("<Owner>");
            _builder.Append(String.Format("<item>{0}</item>", name));
            _builder.Append(String.Format("<item>{0}</item>", address));
            _builder.Append(String.Format("<item>{0}</item>", age));
            _builder.Append("</Owner>");
            _builder.Append("</Owners>");
        }
        return _builder.ToString();
    }

Thanks for the help. Let me know if this was not clear enough.

Here is more of what I mean…

enter image description here

Here is the answer:

foreach (RepeaterItem item in rptOwners.Items)
        {
            var lblOwnerName = (Label)item.FindControl("lblOwnerName");


            _builder.Append("<Owners>");
            _builder.Append("<Owner>");
            _builder.Append(String.Format("<item>{0}</item>", lblOwnerName));
            _builder.Append(String.Format("<item>{0}</item>", item));
            _builder.Append(String.Format("<item>{0}</item>", item));
            _builder.Append(String.Format("<item>{0}</item>", item));
            _builder.Append(String.Format("<item>{0}</item>", item));
            _builder.Append(String.Format("<item>{0}</item>", item));
            _builder.Append(String.Format("<item>{0}</item>", item));
            _builder.Append("</Owner>");
            _builder.Append("</Owners>");


        }
        return _builder.ToString();
  • 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-24T07:25:55+00:00Added an answer on May 24, 2026 at 7:25 am

    Try this (i only added a cast):

    public string xmlString
    {
    get
    {
        var _builder = new StringBuilder();
    
        var rpt = (IList<Owner>) rptOwners.DataSource; //ADDED A CAST
        IList<string> ownersRepeater = new List<string>();
    
        foreach (var item in rpt )
        {
            _builder.Append("<Owners>");
            _builder.Append("<Owner>");
            _builder.Append(String.Format("<item>{0}</item>", name));
            _builder.Append(String.Format("<item>{0}</item>", address));
            _builder.Append(String.Format("<item>{0}</item>", age));
            _builder.Append("</Owner>");
            _builder.Append("</Owners>");
        }
        return _builder.ToString();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hashtables have a syncroot property but generic dictionaries don't. If I have code that
I have the follwing code inside a facelet page: <h:inputNumber value=bean.property> <f:convertNumber type=currency />
I've been using Visual Studio's property sheets for building my code and I have
I have this code that takes info from a form and sends it to
What's the simplest way to code against a property in C# when I have
I'm on a roll today... I have the following code delaring a dependency property
Hi I have a field that uses ajax to bring up product/item information <input
We have a web application that periodically sends out e-mails to users. At the
I have a Delphi 6 application that sends bitmaps to a DirectShow DLL in
I have written some VSTO (2003) code that sucessfully applies some mandatory subject line

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.