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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:04:00+00:00 2026-05-16T20:04:00+00:00

Could someone point me in the right direction on how would I go about

  • 0

Could someone point me in the right direction on how would I go about creating htmlhelpers that you could call in the view something like the code below.

   <% using (Html.BeginSvg())
   {%>
   <% using (Html.BeginGroup("Group1")) {%>
        <%= Html.SvgLine("Line1").Class("blueLine").Style("stroke-width:2px").X1(25).Y1(25).X2(25).Y2(25).Transform().Scale(-2)%>
        <%= Html.SvgLine("Line1").Class("blueLine").Style("stroke-width:2px").X1(100).Y1(25).X2(100).Y2(125).Transform().Scale(-2)%>
   <%} %>
   <%= Html.SvgRect("box").Class("redBox").X(12).Y(10).Width(234).Height(200) %>
<%} %>

Is it possible? is it sane? 🙂 is there something like this already implemented?

Cheers
Si

  • 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-16T20:04:00+00:00Added an answer on May 16, 2026 at 8:04 pm

    I don’t know if it’s been done but Fluent Interfaces are awesome…here’s a very basic implementation for you.

    public static class SvgLineHelper {
        public static SvgLine SvgLine(this HtmlHelper helper, string name) {
            return new SvgLine(name);
        }
    }
    
    public class SvgLine {
        string _name;
        int _x;
        int _y;
        int _width;
        int _height;
        IList<string> _styles;
    
        public SvgLine(string name) {
            _styles = new List<string>();
            _name = name;
        }
    
        public static SvgLine Create(string name) {
            return new SvgLine(name);
        }
    
        public SvgLine X(int x) {
            this._x = x;
            return this;
        }
    
        public SvgLine Width(int width) {
            this._width = width;
            return this;
        }
    
        public SvgLine Style(string style) {
            this._styles.Add(style);
            return this;
        }
    
        public override string ToString() {
            //create your string from this object here
            return string.Format("x:{0}, width:{1}, style:{2}", _x, _width, _styles[0]);
        }
    }
    

    And here’s how you use it in your html

    <% Html.SvgLine("test").X(100).Width(50).Style("stroke-width:2px").ToString() %>
    

    You have to call the tostring method as the last call (or another method that finalizes your fluent interface – the one that returns a string representation of your object)

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

Sidebar

Related Questions

Could someone here point me in the right direction about how I can override
Could someone please point me in the right direction with respect to OHLC data
Just wondering if someone could point me in the right direction of how to
I am wondering if someone could point me in the right direction. You know
I'm just wondering if someone could point me in the right direction here, I
I was wondering if someone could point me in the right direction with this
could someone please point me in the right direction, I currently have a searchable
I was just hoping that someone could point me to a reference that defines
Could someone point out to me which directory I should be using to work
Could someone please point me toward a cleaner method to generate a random enum

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.