Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 27, 2012 06:07 PM by smoothcoder
Member
8 Points
53 Posts
Nov 27, 2012 04:54 PM|LINK
<input type="submit" value="Add" />
And in controller
public ActionResult Add()
{ return View("Index"); }
On submit click it is not hitting the ActionResult Method. Am I missing anything here?
Please help me Im new to MVC.
26 Points
3 Posts
Nov 27, 2012 05:03 PM|LINK
Is the input element wrapped in an html form? Like @using(Html.BeginForm("Add", "YourController")){.... <input.....> ....}?
Star
12546 Points
1867 Posts
Nov 27, 2012 05:08 PM|LINK
You are missing Post Add method
Follow this step by step article to start learning MVC
Intro to ASP.NET MVC 4
Watch introductory videos and read more on MVC
Nov 27, 2012 05:20 PM|LINK
I just had <html> tags
<html>
.....
.......
<Input type="" ...../>
</html>
Nov 27, 2012 06:07 PM|LINK
Then yes, you should wrap the input in an HTML form element.
You could start with reading this
Ravi Kovoor
Member
8 Points
53 Posts
Input Type=Submit
Nov 27, 2012 04:54 PM|LINK
<input type="submit" value="Add" />
And in controller
public ActionResult Add()
{ return View("Index"); }
On submit click it is not hitting the ActionResult Method. Am I missing anything here?
Please help me Im new to MVC.
smoothcoder
Member
26 Points
3 Posts
Re: Input Type=Submit
Nov 27, 2012 05:03 PM|LINK
Is the input element wrapped in an html form? Like @using(Html.BeginForm("Add", "YourController")){.... <input.....> ....}?
Nasser Malik
Star
12546 Points
1867 Posts
Re: Input Type=Submit
Nov 27, 2012 05:08 PM|LINK
You are missing Post Add method
Follow this step by step article to start learning MVC
Intro to ASP.NET MVC 4
Watch introductory videos and read more on MVC
Skype: maleknasser1
Ravi Kovoor
Member
8 Points
53 Posts
Re: Input Type=Submit
Nov 27, 2012 05:20 PM|LINK
I just had <html> tags
<html>
.....
.......
.......
<Input type="" ...../>
</html>
smoothcoder
Member
26 Points
3 Posts
Re: Input Type=Submit
Nov 27, 2012 06:07 PM|LINK
Then yes, you should wrap the input in an HTML form element.
You could start with reading this