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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T08:28:42+00:00 2026-06-13T08:28:42+00:00

I’m learning Web Forms, and I’m trying to convert an order form I had

  • 0

I’m learning Web Forms, and I’m trying to convert an order form I had been building. I learned about XmlDataSource to source my XML file and Repeater to build a template to present the data, and all is mostly well.

First a sample of how my XML works, and then the problem:

<items>
    <item id="sheet-1">
        <name>Sheet the First</name>
        <price id="single" />
    </item>

    <item id="sheet-2">
        <name>Sheet the Second</name>
        <price id="double" />
    </item>
</items>

<costs>
    <cost id="single">.10</cost>
    <cost id="double">.20</cost>
    <cost id="triple">.30</cost>
</costs>

With my pre-Web Forms setup, I created a foreach loop to store all of the cost IDs and values in an array, and then when I looped through each item, I matched the price ID to the cost ID and then output the corresponding value.

I’d like to create the same effect within a Repeater. How I saw it in my head was something like this…

<p class="cost-line">
<%#XPath("../../costs/cost[@id='XPath("price/@id")']") %>
</p>

But I knew that that syntax was highly unlikely to work.

I’m not entirely sure how to word the question. I believe what I’m trying to do is use foreign keys with XPath and Repeaters. Is this possible? If not, what alternatives exist to get where I’m trying to go?

  • 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-06-13T08:28:43+00:00Added an answer on June 13, 2026 at 8:28 am

    Assuming you are using XDocument and that you are binding this way :

    yourRepeater.DataSource = yourXDocument.Root.Element("items").Elements("item").ToList();
    yourRepeater.DataBind();
    

    you can have a getCost method :

    protected String getCost(XElement xel) 
      {
       return xel
                .Parent
                .Parent
                .Element("costs")
                .Elements("cost")
                .Where(x=>x.Attribute("id").Value==xel.Element("price").Attribute("id").Value)
                .First().Value;
      }
    

    and then try something like this :

     <p class="cost-line">
        <%#this.getCost((XElement)Container.DataItem) %>
     </p>
    

    hope this will help

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I am trying to understand how to use SyndicationItem to display feed which is
I have a jquery bug and I've been looking for hours now, I can't
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am reading a book about Javascript and jQuery and using one of the
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I have a text area in my form which accepts all possible characters from

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.