Click here to Skip to main content
15,114,611 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,
How can I handle ASP Buttons in ASP .NET MVC?
Posted
Comments
StianSandberg 13-Aug-12 2:45am
   
It does not work the same way is it does in asp.net. MVC are back to basic html-forms and controllers to get the forms value..
Prabhakaran Soundarapandian 13-Aug-12 2:46am
   
Handle???Are you using mvc2 or mvc3???
Can you provide more information..
JOHN_726 13-Aug-12 3:23am
   
I am using MVC3, i want to use ASP buttons.

1 solution

ASP is not ASP.NET. And, you can't. There are no server controls in MVC. You emit html, and then you can do one of several things.

1 - put submit buttons on your form, and add a 'Command' attribute and a string parameter named Command to your HttpPost version of your controller method to see what was called.

2 - Make AJAX requests using JSON and jQuery, which can then call methods you write in your controller directly, with a method signature conforming to your JSON variables.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900