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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:03:05+00:00 2026-06-10T05:03:05+00:00

This question relates to ASP.Net 3.5 and C# I’m building an RSS Feed from

  • 0

This question relates to ASP.Net 3.5 and C#

I’m building an RSS Feed from a database containing a lot of columns.

I need to format the data in a particular node and doing it inline is going to be very messy.

I’m aware I can pass all the parameters individually to a subroutine

    <%# formatAddress(Container.DataItem["propertyName"],
        Container.DataItem["propertyNumber"], ... ) %>

As there’s going to be up to 20 of these columns, I’d rather pass the entire row.

    <%# formatAddress(Container.DataItem) %>

This would be ideal then I can pick out the columns I want in code behind:

    protected string FormattedAddress(object row)
        {

        DataRowView data = (DataRowView)row;

        StringBuilder Address = new StringBuilder();
        string Postcode = data["propertyPostcode"];
        ...
        return Address.ToString();
    }

I’m getting the error Unable to cast object of type ‘System.Data.Common.DataRecordInternal’ to type ‘System.Data.DataRowView’.

Previously, I was using protected string FormattedAddress(DataRowView row) but that didn’t work either.

Any clues?

  • 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-10T05:03:06+00:00Added an answer on June 10, 2026 at 5:03 am

    Eventually found a couple of examples which led me to realise I should be casting to DbDataRecord.

    I’m still passing <%# formattedAddress(Container.DataItem) %> but my function is now as follows:

        protected string FormattedAddress(object dataItem)
        {
            DbDataRecord data = (DbDataRecord)dataItem;
    
            string Postcode = data.GetValue(
                              data.GetOrdinal("propertyPostcode")).ToString();
            ...    
            return NicelyFormattedAddress;
        }
    

    Is this the best way to handle the data?

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

Sidebar

Related Questions

This question relates to ASP.NET MVC3 using the Razor Engine. What I need to
This question most closely relates to the asp.net mvc3 framework. It started out as
This question relates to ASP.NET MVC 2 RC (December drop). The basic problem is
This question relates to an ASP.NET website, originally developed in VS 2005 and now
This question is related to my ASP.NET MVC 2 development, but it could apply
Greetings, The question relates to ASP.NET MVC I am creating some divs dynamically using
I have one problematic question on custom validator at client side in asp.net? This
Related to this question I play around with XSS issues in my ASP.NET MVC
This question is directly related to my previous question ASP.NET AJAX Is it possible
This question is kind of related to Handle URI hacking gracefully in ASP.NET in

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.