dimanche 27 décembre 2015

How to pass textbox value to controller in mvc4

How to pass the value on this textbox to controler.

In Index.cshtml file

<!DOCTYPE html>
    <meta charset="utf-8" />
        <input type="text" id="test" name="test" />
        <input type="submit" value="Click" />

In MyHomeControler file

public ActionResult Index(string test)
     string val = test;
     return View();

Aucun commentaire:

Enregistrer un commentaire