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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T19:30:20+00:00 2026-05-11T19:30:20+00:00

Having used Seaside the past few years I’ve found template systems to be a

  • 0

Having used Seaside the past few years I’ve found template systems to be a bad code smell. Is there a framework for .net using something similar to the Seaside canvas system for generating html, css and javascript? Or else a way to avoid the duplication I tend to find in templates.

[Edit]
NHaml does not come close to what I’m looking for. The point is not having a shorthand for (X)HTML, but having a programming language in which I can refactor and reuse the code.

In Seaside, it might look like this: (the canvas is the builder of html [and javascript])

renderContentOn: canvas
    canvas form
        class: 'eventEditor';
        with:[
            self renderWhoOn: canvas;
                 renderButtonsOn: canvas]

In this method, I call two subroutines

renderWhoOn: canvas
self decorateDivAndLabel: 'Who' on: canvas around: [
    canvas select
        id: tagId;
        selected: model who;
        list: model whoList;
        callback: [:value | model who: value]]

The first one calls a decorator around a select form element:

decorateDivAndLabel: aString on: canvas around: aBlock
canvas div: [
    canvas label
        for: (tagId := canvas nextId);
        with: aString,':'.
    aBlock value]

This allows eliminating almost all duplication.

  • 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-11T19:30:20+00:00Added an answer on May 11, 2026 at 7:30 pm

    I have similar feelings about template systems (see ASP.MVC: Implementing a non-templated view engine?), and after experimenting a little, I took the following approach:

    • Implemented a fluent HTML generator C# class which does not write directly to a stream, instead it constructs the whole HTML page as an in-memory object hierarchy.
    • Higher-level (reusable) pieces of HTML code (like complex input controls etc.) are implemented as separate classes and are inserted as nodes into this hierarchy, and can expand themselves into plain HTML nodes automatically.
    • MVC Views are then POCO C# classes which construct the HTML hierarchy and write it out into the response stream.

    Some of the benefits (from my perspective):

    • You still retain control over HTML
    • Reusability, inheritance, encapsulation…
    • The result is auto-formatted (indents, XHTML etc.)
    • And best of all… no template scripting using a separate DSL.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having used optional parameters in a few classes here and there, I'm starting to
Having used Haml and Sass for a few Rails side projects, I've found that
Having used other MVC frameworks such as Zend Framework in the past, I am
After having used an application for over 10 years, and been constantly limited by
I just today stumbled upon the Code Metrics thing, after having used Visual Studio
Having used Java for some years already, we know what we are gaining by
I just installed Ruby 1.9.2 after having used 1.8.7, as there is a feature
I'm relatively new to git, having used Subversion primarily in the past. I recently
I just setup AnkhSVN after having used TFS till now What in AnkhSVN is
I'm new to the Oracle Platform (having primarily used MySQL, with a little Postgres

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.