ASP。NET MVC视图(五)

  


<强> <强> <强> <强> <强>

<强>

RazorwebformHtml

<强> <强>

<强>

<强>剃刀 <强>

<强>剃刀 <强>

<强>

<强> <强>剃刀 <强> <强>

,

-

剃刀”;“剃刀

,

<强>

1。

1 - 1

Html.ActionLink (,)

@1-1指数

空白

,

<强>

剃刀“@ {}”“@ {”“}”.csC #; 2。

1 - 2

<强>

ASP。净MVCHtmlHelperASP。净MVC.csHtmlHtmlHelperASP。净MVC()输入

,

<强>复选框 <强>

HtmlHelper.CheckBox HtmlHelper ()。CheckBoxFor () lambdaModel

1-3ViewModel:

ID {;;}

{名称;;}

检查{;;}

1-4View

, Model.Check)

,

ChecktrueHtml12 1

 ASP。NET MVC视图(五)2

 ASP。净MVC视图(五)

2, CheckBoxinput

,

<强> Radiobutton <强>

Radiobutton ()

1 - 5

, Model.Check)

, Model.Check, Model.Check)

、!模型。检查,! Model.Check)

模型

3

 ASP。NET MVC视图(五)

ModelChecktrue 4

 ASP。净MVC视图(五)

4 Html

,

RadioButtonFor ()

1 - 6

Model.ID

Html。RadioButtonFor(模型=比;model.Check,模型。检查,{id=})

Html。RadioButtonFor(模型=比;model.Check !模型。检查,{id=})

1-6RadioButtonFor () lambdaRadioButtonFor ()

RadioButtonFor模型()InputInputIdInput 5

 ASP。NET MVC视图(五)


6

 ASP。NET MVC视图(五)


ViewModel1-7。1 - 7

ID {;;}

{名称;;}

检查{;;}

EnumCase {;;}

1-7ViewModel1-8 1 - 8

@model  MvcApplication.Models.CustomerInfo   @using  MvcApplication.Models   & lt; h2> @Model.ID   & lt; h3> @Model.Name   @Html.CheckBox(“检查”,Model.Check)   @Html.CheckBoxFor(模型=祝辞,model.Check)   & lt; div 类=@Model.ID>   ,,,& lt; p>   ,,,,,,,@Html.RadioButtonFor (model =祝辞,model.EnumCase,, EnumCase.EnumOne,,新{,id =,“迎合广大”,})& lt;/p>   ,,,& lt; p>   ,,,,,,,@Html.RadioButtonFor (model =祝辞,model.EnumCase,, EnumCase.EnumTwo,,新{=,id “radio2”,}) & lt;/p>   ,,,& lt; p>   ,,,,,,,@Html.RadioButtonFor (model =祝辞,model.EnumCase,, EnumCase.EnumThree,,新{=,id “radio3”,}) & lt;/p>   & lt;/div>


ViewModel1-9

1 - 9

() {ID=Name=, EnumCase=.EnumThree};

,

输入

Html.CheckBox复选框(“myCheckBox”,假)

& lt;输入ID=" myCheckBox " Name=" myCheckBox类型=案囱】颉奔壑?https://www.yisu.com/zixun/"真正的"/>

隐藏字段

Html.Hidden (“mHidden”、“val”)

Html.RadioButton无线电按钮(“myRadiobutton”、“val”,真正的)

Html.Password密码(“我的密码”,“val”)

文本框

Html.TextBox (“myTextbox”、“val”)




ASP。NET MVC视图(五)