mvc4 receive form in a controller

Posted by Marco Dinatsoli on Stack Overflow See other posts from Stack Overflow or by Marco Dinatsoli
Published on 2013-10-26T15:51:20Z Indexed on 2013/10/26 15:53 UTC
Read the original article Hit count: 311

Filed under:
|
|
|
|

i have a form in html and i want to submit it to a controler

what i have tried

@using (Html.BeginForm("RegisterApartmentOwner", "Home", FormMethod.Post, 
                            new { enctype = "multipart/form-data" }))
                            {
    <p>
        <label>First Name</label>
        <input type="text" placeholder="Enter your first Name" name="firstName" />
        <span class="errorMessage"></span>
    </p>
    <p>
        <label>Last Name</label>
        <input type="text" placeholder="Enter your last Name" />
        <span class="errorMessage"></span>
    </p>
    <p>
        <label>Password</label>
        <input type="text" placeholder="Enter your password" name="Password"/>
        <span class="errorMessage"></span>
    </p>
    <p>
        <label>Password Again</label>
        <input type="text" placeholder="Enter your password again" name="Password2"/>
        <span class="errorMessage"></span>
    </p>
    <p>
        <label>Mobile Number</label>
        <input type="text" placeholder="Enter your mobile number" />
        <span class="errorMessage"></span>
    </p>
    <p>
        <input type="submit" value="Register"  class="submit"/>
    </p>
    }
</div>

and in the controller i receive the submit in this function

public String RegisterTenant() {
            return "done";
        }

i can see the done message, however, i want to receive the values of the input that i used in the form, how please?

i just to know what to receive the form in the controller

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET