c# - MVC submit button not firing -
c# - MVC submit button not firing -
i using asp.net mvc 4 razor engine.
i have page (index.cshtml) , controller (homecontroller.cs)
i trying hook submit button action result in controller - can't seem fire.
my html :
@using (html.beginform("submitform", "home", formmethod.post)) { <div class="main-background"> ******lots of other html here******* <button type="submit" id="btnsave">save</button> </div> } controller :
public class homecontroller : controller { public actionresult index() { viewbag.message = "modify template jump-start asp.net mvc application."; homecoming view(); } public actionresult about() { viewbag.message = "your app description page."; homecoming view(); } public actionresult contact() { viewbag.message = "your contact page."; homecoming view(); } [httppost] public actionresult submitform() { homecoming view(); } } at moment havn't implemented model pass values through controller, wanted see if actionresult submitform fire.
i have tried @using (html.beginform()) no parameters, have tried including [httppost] above actionresult, without luck.
edit have tried using <input type="submit" id="btnsave">save</input> instead of button.
not sure going wrong
it turns out jquery stopping actionresult beingness hit.
i had button click event "eating up" actionresult functionality. solved calling actionresult using ajax.
c# asp.net asp.net-mvc asp.net-mvc-4 razor
Comments
Post a Comment