Neir0
Neir0

Reputation: 13367

parameters and action

How can i pass to asp.net mvc action parameters like: line[first], line[second], line[third], people[john] etc?

For example we have html:

<form>
<input type="hidden" name="line[first]" value="hello" />`
<input type"submit" value="send" />
</form>

How we can take "line[first]" value when user clicks on send button?

Upvotes: 0

Views: 97

Answers (1)

davethecoder
davethecoder

Reputation: 3932

[HttpPost, ValidateAntiForgeryToken]
    public ActionResult ShowLogin(LoginModel model)
    {
        model.username;
        model.password
    }

instead of admin you can have

public ActionResult ShowLogin(FormCollection form)
 {
    var user = form["username"];
   }

Upvotes: 2

Related Questions