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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:01:19+00:00 2026-05-13T07:01:19+00:00

I am looking for a mechanism to transform dataobjects into HTML. The elements in

  • 0

I am looking for a mechanism to transform dataobjects into HTML. The elements in the dataobject are of both, simple and complex types. I have tried playing with HtmlTextWriter for rendering but got stuck with complex types.

Mine is an ASP.Net website project. I have to avoid using server side controls (and therefore do away with built in binding capabilities) as the front end processing is done with the help of jQuery. I need to just churn out basic HTML for my dataobjects and the rest of enrichment (content arrangement and styling) will be done at the frontend.

I am looking for a simple solution (I found Spring.Net an overkill and overwhelming and NHAML also very confusing).

Further, my application is expected to grow over a period of time so I need to have some respect for performance. Therefore I am avoiding bringing XML/XSLT in the picture.


For eg. A Person object will be something like this:

String: Name
Int: Age
Complex Type: Address (includes Street, City, Zip)
Array of Type “Qualification” : Qualifications (includes Degree, Passing Year, Grades)

Desired output is:

<p id="userName" class="userName">John</p>
<p id="age" class="age">35</p>
<div id="address" class="address">
    <p id="street" class="street">Express Highway</p>
    <p id="city" class="city">Mumbai</p>
    <p id="zip" class="zip">400101</p>
</div>
<div id="qualifications" class="qualifications">
    <div id="qualification1" class="qualification">
        <p id="degree1" class="degree">B.Sc.</p>
        <p id="year1" class="year">1990</p>
        <p id="grade1" class="grade">A</p>
    </div>
    <div id="qualification2" class="qualification">
        <p id="degree2" class="degree">M.Sc.</p>
        <p id="year2" class="year">1992</p>
        <p id="grade2" class="grade">A</p>
    </div>
</div>

A point to note here is that a mapper would be required to map the properties from the source dataobject, add some metadata to it (like HTML element attributes, etc) and then carry out the transformation.

  • 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-13T07:01:19+00:00Added an answer on May 13, 2026 at 7:01 am

    I’m looking at it as a design problem and elaborate answer on much higher perspective that is design and not the code! The correct way to do this would be as following.

    • Person type is holding the information and it is data-centric so I recommend not to put any html-rendering responsibility into this class.

    • First you will need to have an abstract base-class for all your business/data objects. Let us assume [becuase you’ll need to have it] BusinessBase.

    • So you should start writing a server-control that derives from System.Web.UI.WebContorl. Expose a property that takes an object of type BusinessBase in it’s set accessor.

    • Now you need define some custom Attributes that is applied to properties of any sub-class of type BusinessBase. This attribute holds the renderring output information for that particular property of the business/data object. Decorate all properties which you want to be renderred in html.

    • Come back to your web-server-control and via use reflection to iterate through all properties [having your custom-attribute] of object which has been assigned to the server control property of type BusinessBase. Render the html as per the attribute.

    Now use this web-server-control and business object in your asp.net front-ends. Have fun.

    This is a high-level design. You’ll need to be more discrete and
    specific in your attribute as to what
    html rendering is generated for the
    business object.

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

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer You can use a CustomValidator control and specify an ClientValidationFunction… May 13, 2026 at 5:02 pm
  • Editorial Team
    Editorial Team added an answer You can simply iterate over each line in Python. Use… May 13, 2026 at 5:02 pm
  • Editorial Team
    Editorial Team added an answer try closing your channel after use using (InterfaceClass.IService serviceobj =… May 13, 2026 at 5:02 pm

Related Questions

I am looking for some guidance on how to incorporate business rules into an
I am designing the application in Flex that connects to some web services to
I am looking for any tips or resources on importing from excel into a
What's the best way to localize a PHP page? We have several PHP pages
I am looking for a way to determine for a thread on which other

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.