您的位置:首页 > Web前端 > HTML

MVC进阶学习--HtmlHelper控件解析(二)

2009-10-10 15:16 411 查看
1.InputExtensions类
InputExtensions类主要有5种类型的扩展方法,分别用于CheckBox控件,Hidden控件,Pass控件,RadionButton控件,TextBox控件

2.CheckBox控件
有如下重载方法:
CheckBox(string name);
CheckBox(string name,bool isChecked);
CheckBox(string name,book isChecked,object htmlAttributes);
CheckBox(string name,object htmlAttributes);
CheckBox(string name,IDictionary<string ,object> htmlAttributes);
CheckBox(string name,book isChecked,IDictionary<string ,object> htmlAttributes);
例子:
页面代码
Code
<%=Html.RadioButton("Sex", "男", new { id="man"})%>男<br />
<%=Html.RadioButton("Sex", "女", new { id="woman"})%>女<br />

<input id="man" name="Sex" type="radio" value="男" />男<br />
<input id="woman" name="Sex" type="radio" value="女" />女<br />
3.Hidden控件
Hidden(string name);
Hidden(string name,object value);
Hidden(string name,object value,object htmlAttrbutes);
Hidden(string name,object value,IDictionary<string ,object> htmlAttributes);
该方法生产隐藏表单域

4.PassWord控件
Password(string name);
Password(string name,object value);
Password(string name,object value,object htmlAttrbutes);
Password(string name,object value,IDictionary<string ,object> htmlAttributes);
该方法生成PassWord输入框

5.TextBox控件
TextBox(string name);
TextBox(string name,object value);
TextBox(string name,object value,object htmlAttrbutes);
TextBox(string name,object value,IDictionary<string ,object> htmlAttributes);
该方法生成普通文本输入框
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: