خرید بک لینک

Vote count: 0

In my ASP MVC web application. I have this controller

namespace Test.Controllers
{
    public class HomeController : Controller
    {
        // GET: Home
        public ActionResult Index(UserDetails user)
        {
            user.UserEmail = "Email one";
            retu View(user);
        }

        // Post: Home
        [HttpPost]
        public ActionResult Index(UserDetails user, string command)
        {
            user.UserEmail = "Email two";
            retu View(user);
        }

        #region Helpers
        #endregion
    }
}

and this view

@model Test.Models.UserDetails

@{    Layout = null;}

    <!DOCTYPE html>

    <html>
    <head>
        <meta name="viewport" content="width=device-width" />
        <title>Index</title>
    </head>
    <body>
@using (Html.BeginForm("Index", "Home", FormMethod.Post))
{                    
@Html.DisplayNameFor(model => model.UserEmail)
       @Html.EditorFor(model => model.UserEmail)
       <input type="submit" name="Command" value="Search" class="btn btn-default" />
A}
    </body>
</html>

When I first run the application it will show “Email one” in the textbox. But when I hit the submit button it will not change the value in the textbox to “Email two”. What I have to change on my code?

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: شنبه 15 خرداد 1395 ساعت: 4:35

صفحه بندی