Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Access a POST value from View

Is there a way to access a POST value from the View (without passing by the controller)

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        @Html.TextBox("SomeValue")    
        <input type="submit" value="Submit" />
    </fieldset>
}

The value being posted is @SomeValue

What is the right syntax for @SomeValue

like image 910
Anas Avatar asked Mar 24 '26 13:03

Anas


1 Answers

I think the forms collection could be accessed by:

HttpContext.Current.Request.Form

...but why? It defeats the purpose of MVC.

like image 95
Faust Avatar answered Mar 26 '26 14:03

Faust



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!