asp.net mvc 3 - Using buttons in MVC3 -


In my opinion, I am using the button like this

    

and thus handle them in the controller

  [HTTP post] Public ActionRashult Index (BuilderGone model model, string button) {If (button == " Add ") {} if (button ==" save ") {} if (button ==" cancel ") {} return view (model); }   

Is there any way i can do something

   gt; add & lt; / a & gt; & lt; a Href = "#" onclick = "javascript: location.href = '@ Url.Action (" "," ")"' class = "redbutton" & gt; Save & lt; / A & gt; & Lt; A href = "#" onclick = "javascript: location.href = '@ Url.Action (" Home "," Index ")," class = "redbutton" & gt; cancel & lt; / a & gt; < The code should be done with the Submit Submit button. This means that the correct HTML is / code>   

Anchors should not be used for posting and submitting forms. They are used to issue redirects and GET requests An anchor can not submit a form. You will need to fill out the form to write javascript and duplicate when this is clicked so that all form fields can be sent.

Do not recommend it.

For example, things like adding a focus inside a text field will not be included and you will have to write additional JavaScript to handle this case in which all the internet Users have become addicted. This is a nightmare the way you submit the start button, that's right.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -