【input】——数据传入后台

1.复选框 checkbox

<label class="checkbox">

  <input type="checkbox" name="c1" value="ck1"/>复选框1

</label>

<label class="checkbox">

  <input type="checkbox" name="c2" value="ck2"/>复选框2

</label>

对应model:

public string c1 {get;set;}

public string c2 {get;set;}

在controller中:

public ActionResult SearchButton (string c1)

{ return View(); } 设置断点就可以查看数据,以下同理

2.单选框 radio

<label class="radio">

  <input type="radio" name="r" value="r1"/>单选框1

</label>

<label class="radio">

  <input type="radio" name="r" value="r2"/>单选框2

</label>

对应model:public string r {get;set;}

3.文本框 text

<input type="text" name="text1" value=""/>

对应model:public string text1 {get;set;}

4.密码框 password

<input type="password" name="password1" value=""/>

对应model:public string password1 {get;set;}

5.文本域 textarea

<textarea name="textarea1"></textarea>

对应model:public string textarea1 {get;set;}

原文地址:https://www.cnblogs.com/YYvam1288/p/5388095.html