We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Set button formaction attribute for routing multiple buttons to different actions in controller

Thread ID:





124225 May 25,2016 01:20 PM UTC May 27,2016 05:44 AM UTC ASP.NET MVC 3
Tags: Button
Tom Frajer
Asked On May 25, 2016 01:20 PM UTC

Hi I want to use HTML5 atribute formaction to route multiple buttons to different actions in my controller. 
In HTML it is like this:

<input type="submit" name="ok" value="OK" formaction="/Controller/Save" formmethod="post" />
<input type="submit" name="back" value="Back" formaction="/Controller/Back" formmethod="post" />

My question is, how can I set formaction attribute on this Syncfusion button:


Deepa Loganathan [Syncfusion]
Replied On May 26, 2016 08:42 AM UTC

Hi Tom,    
Thanks for contacting Syncfusion support.    
You can achieve this requirement by using “HtmlAttributes” API in Button EJHelper.   
Please refer the below code example:   
        Dictionary<string, object> btnAttributes = new Dictionary<string, object>(); 
        btnAttributes.Add("formaction", @Url.Action("Change", "Form")); 
        @using (@Html.BeginForm()) 

Please let us know if you need any further assistance.   
Deepa L. 

Tom Frajer
Replied On May 26, 2016 11:51 AM UTC

Perfect! Thank you :)

I just simplified it into this:

@Html.EJ().Button("call_yes").Text("Call YES").HtmlAttributes(new Dictionary<string, object> { { "formaction", "/Ticking/TickingCallYes" } }).Type(ButtonType.Submit).Size(ButtonSize.Medium)

Deepa Loganathan [Syncfusion]
Replied On May 27, 2016 05:44 AM UTC

 Hi Tom,    
Thanks for the update.     
We are glad to know that the given solution has met your requirement.     
Please let us know if you need any further assistance.     
Deepa L.    


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon