VikingsTHT

导航

HTMlhleper

@{
ViewBag.Title = "Index";
}

<h2>Index</h2>

<div>
@{
int id=12121;
var ID = 34443;
string name = "Tom";
string Name = "jim";
}
</div>

<div>@id</div>
<div>@ID</div>
<div>@name</div>
<div>@Name</div>
<div>字符串拼接aa @id bb</div>
<div>名字拼aa @{@name}bb</div>
<div>
@{
<div>
<br/>文本
内部<br/>
<br/>
</div>
@:内部<br/>文本二


}

</div>

<br/>
@*Html.TextBox*@

@*//服务端写法*@
@Html.TextBox("txtUserName")
@*//客户端生成*@
<input id="txtUserName" name="txtUserName" type="text" value="" />

 

<br/>
@*Html.Password*@

@* //服务端写法*@
@Html.Password("txtPassword")
@* //客户端生成*@
<input id="txtPassword" name="txtPassword" type="password" />

<br/>
@*3.Html.Label*@

@*//服务端写法*@
@Html.Label("txtUserName", "显示值")
@*//客户端生成*@
<label for="txtUserName">显示值</label>

 

 

<br/>

@*4.Html.DropDownList*@


@* 服务端写法 *@
@{
//下拉列表的值
List<SelectListItem> selectList = new List<SelectListItem>();
selectList.Add(new SelectListItem { Value = "1", Text = "列表项一" });
selectList.Add(new SelectListItem { Value = "2", Text = "列表项二" });
}
@Html.DropDownList("ddlList", (SelectList)new SelectList(selectList.AsEnumerable(), "Value", "Text"))
@* //客户端生成*@
<select id="ddlList" name="ddlList"><option value="1">列表项一</option>
<option value="2">列表项二</option>
</select>

<br/>

@* Html.RadioButton*@

@* //服务端写法*@
@Html.RadioButton("rdo", "男")
@* //客户端生成*@
<input id="rdo" name="rdo" type="radio" value="男" />


<br/>

@* Html.CheckBox*@

@* //服务端写法*@
@Html.CheckBox("chk")
@* //客户端生成*@
<input id="chk" name="chk" type="checkbox" value="true" /><input name="chk" type="hidden" value="false" />

<br/>

@*7.Html.ActionLink*@

@*//服务端写法*@
@Html.ActionLink("链接首页", "Login")
@*//客户端生成*@
<a href="/User/Login">链接首页</a>

posted on 2015-12-04 17:08  VikingsTHT  阅读(187)  评论(0编辑  收藏  举报