服务器控件类与HTML标签之间的对应关系

通过查看System.Web.UI.HtmlControls命名空间,可以发现,很多HTML对应的标签都可以通过添加runat=”server”属性转化为服务器控件,比如<table>会转化为HtmlTable对象,但像<input >标签可以通过type属性对应不同的服务器对象。当html内的标签没有和上图中的服务器控件匹配时,所有不匹配的html标签都会通过添加runat=”server”转化为HtmlGenericControl服务器控件。下面是对应的服务器控件类与HTML标签之间的对应关系:

HTML Tag

HTML Server Control

<form>

HtmlForm

<input type="text">

HtmlInputText

<input type="password">

HtmlInputText

<input type="radio">

HtmlInputRadioButton

<input type="checkbox">

HtmlInputCheckBox

<input type="submit">

HtmlInputButton

<input type="hidden">

HtmlInputHidden

<input type="button">

HtmlInputButton

<input type="image">

HtmlInputImage

<input type="file">

HtmlInputFile

<button>

HtmlButton

<select>

HtmlSelect

<textarea>

HtmlTextArea

<img>

HtmlImage

<a>

HtmlAnchor

<table>

HtmlTable

<tr>

HtmlTableRow

<td>

HtmlTableCell

其他标签eg:<div>

HtmlGenericControl




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值