码迷,mamicode.com
首页 > Web开发 > 详细

使用ASP.NET服务器控件

时间:2014-12-25 11:14:28      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:

  1. 服务器控件简介

当在浏览器中请求页面时,服务器控件由ASP.NET运行库处理,会将这些控件转换为HTML代码返回给客户端。服务器控件的Runat特性用于指出此控件存活在服务器上,如果没有这个特性,这些控件就不会被ASP.NET运行库处理,且最终会直接为HTML源代码。如页面中的控件Button没有声明Runat属性

    <form id="form1" runat="server">
    <div>
        <asp:Button ID="Button1" Text="Button"/>
    </div>
    </form>

         请求页面后生成的HTML如下图,说明控件没有被服务器处理直接返回给客户端

    <div>
       <asp:Button ID="Button1" Text="Button"/>
    </div>

      2.服务器控件转换为HTML代码

<asp:Label>            -> <span>
<asp:DropDownList>     -> <select>
<asp:Panel>            -> <div>

使用ASP.NET服务器控件

标签:

原文地址:http://www.cnblogs.com/JustYong/p/4184152.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!