Click here to Skip to main content
11,631,896 members (71,304 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET MVC
Hi friends

i am new to MVC please help me..

I created one model,view ,controller
Create and show are the two views

this is my view code

<form method="post" action="Create" runat="server">
        <%if (Model != null)
          { %>
        <%} %>
    <%=Html.TextBoxFor(m=>m.Id )%>
    <%=Html.TextBoxFor(m=>m.Name) %>
    <%=Html.TextBoxFor(m=>m.Dateofbirth) %>
    <%=Html.TextBoxFor(m=>m.Designation )%>
    <%=Html.TextBoxFor(m=>m.Salary )%>
    <input type="button" value="Create"  />

i wrote two methods in controller

        public ActionResult Create()
            return View();
        public ActionResult Create(Employee emp)
            return View("Show", emp);

in post back i want to transfer the data entered by the user to another view i.e "show" in my example

can u guys plz suggest me

here post back action is not hitting .every time the same get method is hitting in post back also
Posted 30-Nov-11 22:22pm
Edited 30-Nov-11 23:07pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Try changing the BUTTON to SUBMIT.


<input type="button" value="Create" onclick="" />
<input type="submit" value="Create" onclick="" />
hitech_ssc at 1-Dec-11 5:08am
thank you very much
hbp33 at 18-Jul-13 2:31am
thank you

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

  Print Answers RSS
0 OriginalGriff 8,393
1 Sergey Alexandrovich Kryukov 8,044
2 Mika Wendelius 6,260
3 F-ES Sitecore 2,321
4 Suvendu Shekhar Giri 1,970

Advertise | Privacy | Mobile
Web03 | 2.8.150728.1 | Last Updated 1 Dec 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100