Altering the ASP.NET MVC 2 ActionResult on HTTP post

Posted by Inge Henriksen on Stack Overflow See other posts from Stack Overflow or by Inge Henriksen
Published on 2010-05-02T20:29:46Z Indexed on 2010/05/02 21:27 UTC
Read the original article Hit count: 626

I want to do some processing on a attribute before returning the view. If I set the appModel.Markup returned in the HttpPost ActionResult method below to "modified" it still says "original" on the form. Why cant I modify my attribute in a HttpGet ActionResult method?

    [HttpGet]
    public ActionResult Index()
    {
        return View(new MyModel
        {
            Markup = "original"
        });
    }

    [HttpPost]
    public ActionResult Index(MyModel appModel)
    {
        return View(new MyModel
        {
            Markup = "modified"
        });
    }

© Stack Overflow or respective owner

Related posts about asp.net-mvc

Related posts about asp.net-mvc-2