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

The Archive Base Latest Questions

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

i have the following Problem: I want to know if it is possible to

  • 0

i have the following Problem:

I want to know if it is possible to modify default html helper methods, e.g. the Html.BeginForm() method.

I know that i can write a custom helper method where i can add some stuff, but some of them have alot of overloaded functions.

then only thing i would need is, that you can add some custom html string “after” the element was rendered

e.g.:

@using(Html.BeginForm("setDate", "DateController", new { DateId = Model.Date.Identifier }, FormMethod.Post, new { id = "setDateForm" })) {
    @* some input here... *@
}

and after the

<form></form>

i would like to render a validation script, or something else, lets say jQuery validator:

<script>$('#setDateForm').validate();</script>

since i dont want to do that over and over again (maybe i could forget it once..) it would be nice to modify the default Html helper.

If it is not possible i just might have to write my own BeginForm or a wrapper for the EndForm helper :/

  • 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-09T08:42:02+00:00Added an answer on June 9, 2026 at 8:42 am

    As a very basic starting point, you could use something like this:

    namespace YourProject.Helpers
    {
        public static class HtmlHelperExtensions
        {
            public static IDisposable CustomBeginForm(this HtmlHelper helper, string html)
            {
                return new MvcFormExtension(helper, html);
            }
    
            private class MvcFormExtension : IDisposable
            {
                private HtmlHelper helper;
                private MvcForm form;
                private string html;
    
                public MvcFormExtension(HtmlHelper helper, string html)
                {
                    this.helper = helper;
                    this.form = this.helper.BeginForm();
                    this.html = html;
                }
    
                public void Dispose()
                {
                    form.EndForm();
                    helper.ViewContext.Writer.Write(this.html);
                }
            }
        }
    }
    

    You’d either need to add the namespace in your view or add it to the web.config file in your Views folder. After that, you can use it like so:

    @using (Html.CustomBeginForm("<p>test</p>")) {
        // Additional markup here
    }
    

    This works for me here but you’d certainly need to customise it to fit your needs, especially as you’ll likely want to pass additional parameters to Html.BeginForm().

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

Sidebar

Related Questions

I have the following problem that I want to solve in awk. I have
I have the following problem. I want to check that the item clicked on
My Problem is the following: I want to create an script that can create
I am using GWT/JAVA for development. I have following problem: I want to remove
I have the following problem: Within a stylesheet document I want to create an
Hi I have the following problem, I want to laod a website with php.
What kind of strategy do I have for the following problem. I want to
I have the following code I want to run, but the problem is $this->type
I have the following code: The actual problem is the non-quoted code. I want
I have a query that I want to execute that fastest possible. Here it

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.