---
title: "What is ActionButton in mvc?"  
description: "What is ActionButton in mvc?"  
author: "Royce Roy"  
published: 2014-10-08  
updated: 2014-10-08  
canonical: https://www.mindstick.com/forum/2340/what-is-actionbutton-in-mvc  
category: "asp.net mvc"  
tags: ["asp.net", "asp.net mvc"]  
reading_time: 1 minute  

---

# What is ActionButton in mvc?

Has [anyone](https://www.mindstick.com/articles/23207/how-to-find-the-best-fit-job-for-anyone) written one? I want it to behave like a [link](https://www.mindstick.com/articles/23633/link-builder) but look like a [button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net). A [form](https://www.mindstick.com/forum/6/multi-form-mfc-application) with a single button wont do it has I don't want any POST.

## Replies

### Reply by Anonymous User

Submit button:

```
<form method="get" action="/myController/myAction/">    <input type="submit" value="button text goes here" /></form>
```

In response to cdmckay's answer, here's an alternative code that uses the TagBuilder class instead of a regular StringBuilder to build the form, mostly for clarity.

```
using System.Web.Mvc;using System.Web.Mvc.Html;using System.Web.Routing; namespace MvcApplication1{    public static class HtmlExtensions    {        public static string ActionButton(this HtmlHelper helper, string value,                              string action, string controller, object routeValues)        {            var a = (new UrlHelper(helper.ViewContext.RequestContext))                        .Action(action, controller, routeValues);             var form = new TagBuilder("form");            form.Attributes.Add("method", "get");            form.Attributes.Add("action", a);             var input = new TagBuilder("input");            input.Attributes.Add("type", "submit");            input.Attributes.Add("value", value);             form.InnerHtml = input.ToString(TagRenderMode.SelfClosing);             return form.ToString(TagRenderMode.Normal);        }    }}
```

I am aware that there might be quite a lot of overhead in this code, but I am expecting that you won't need to run it a lot of times on each page. In case you do, there is probably a bunch of optimizations that you could do.\


---

Original Source: https://www.mindstick.com/forum/2340/what-is-actionbutton-in-mvc

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
