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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:52:34+00:00 2026-05-25T02:52:34+00:00

In my view I am using buttons like this <button style= color:White; height:30px; width:100px;

  • 0

In my view I am using buttons like this

<button style=" color:White; height:30px; width:100px; background-image: url('@Url.Content("~/Content/Images/RedButton.gif")');" name="button" value="Add" type="submit">Add</button>&nbsp;&nbsp;&nbsp;
<button style=" color:White; height:30px; width:100px; background-image: url('@Url.Content("~/Content/Images/RedButton.gif")');" name="button" value="Save" type="submit">Save</button>&nbsp;&nbsp;&nbsp;
<button style=" color:White; height:30px; width:100px; background-image: url('@Url.Content("~/Content/Images/RedButton.gif")');" name="button" value="Cancel" type="submit">Cancel</button>  

and handling them in the controller like this

    [HttpPost]
    public ActionResult Index(BuildRegionModel model, string button)
    {
        if (button == "Add")
            {

            }
        if (button == "Save")
            {

            }
        if (button == "Cancel")
            {

            }
        return View(model);
    }

Is there a way that I can do something like this

<a href="#" onclick="javascript:location.href='@Url.Action("", "")'" class="RedButton">Add</a>
<a href="#" onclick="javascript:location.href='@Url.Action("", "")'" class="RedButton">Save</a>
<a href="#" onclick="javascript:location.href='@Url.Action("Home", "Index")'" class="RedButton">Cancel</a>
  • 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-25T02:52:35+00:00Added an answer on May 25, 2026 at 2:52 am

    Submitting forms should be done with submit buttons. That’s the semantically correct way. That’s how forms should be submitted according to the HTML specification.

    Anchors should not be used for posting and submitting forms. They are used to redirect and issue GET requests. An anchor cannot submit a form. You will have to write javascript and fake a form submission when it is clicked so that all form fields are sent.

    Don’t do it, I wouldn’t recommend it.

    For example things like pressing enter while the focus is inside a textfield will no longer work and you will have to write additional javascript to handle this case to which all internet users are accustomed to. It is a nightmare. The way you did it initially with submit buttons is perfect.

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

Sidebar

Related Questions

I have created an alert view with two buttons using the following code: UIAlertView
I need to change the font style from bold to italic,by using two buttons.for
I am using a custom title view and would like to show/hide a progressbar
I'm using the facebook like button on my site, via an iframe. Now you
This is the code in my partial view - @using (Ajax.BeginForm(SaveLayout, new AjaxOptions {
I want to have a list view with each row having two buttons like
I have a view using a master page that contains some javascript that needs
In my View (using Zend_View so the the view is an object), I make
I wanted to generate one fix view using interface builder, but the size of
I wonder if I can test landscape view using simulator?

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.