ASP.NET
一、如何:使用 ASP.NET 语法将服务器控件添加到 ASP.NET 网页
可以通过在 .aspx 文件中直接声明 Web 服务器控件将它添加到页中。
以声明方式添加控件
A、如果您位于可视化设计器中,请切换到源编辑视图。
B、将表示该控件的元素键入 .aspx 文件。您使用的具体语法取决于要添加的控件,但通常适用下面的情况:
·控件必须包含 runat="server" 属性。
·设置了控件的 ID 属性,除非该控件是某个复杂控件的一部分且重复出现(如在 GridView、FormView、DetailsView、Repeater 或 DataList 控件中一样)。
·Web 服务器控件是使用引用 asp 命名空间的 XML 标记声明的。
·控件声明必须正确结束。您可以指定显式结束标记,或者如果控件不具有子元素,也可以指定一个自结束标记。唯一的例外是不可以包含子元素的 HTML 输入控件,如输入控件(例如,HtmlInputText 服务器控件声明语法、HtmlImage 服务器控件声明性语法和 HtmlButton 服务器控件声明性语法)。
·控件属性声明为属性。
下面的示例显示 Web 服务器控件的典型声明:
<!-- Textbox Web server control -->
<asp:textbox id="TextBox1" runat="Server" Text=""></asp:textbox>
<!-- Same, but with self-closing element -->
<asp:textbox id="Textbox2" runat="Server" Text="" />
<!-- Web DropDownList control, which contains subelements -->
<asp:DropDownList id="DropDown1" runat="server">
<asp:ListItem Value="0">0</asp:ListItem>
<asp:ListItem Value="1">1</asp:ListItem>
<asp:ListItem Value="2">2</asp:ListItem>
<asp:ListItem Value="3">3</asp:ListItem>
</asp:DropDownList>
<asp:Repeater id="Repeater2" runat="server">
<HeaderTemplate>
Company data:
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server"
Font-Names="verda
相关文档:
应用程序状态是可供 ASP.NET 应用程序中的所有类使用的数据储存库。它存储在服务器的内存中,因此与在数据库中存储和检索信息相比,它的执行速度更快。与特定于单个用户会话的会话状态不同,应用程序状态应用于所有的用户和会话。因此,应用程序状态用于存储那些数量较少、不随用户的变化 ......
在许多应用程序中,需要存储并使用对用户唯一的信息。用户访问站点时,您可以使用已存储的信息向用户显示 Web 应用程序的个性化版本。个性化应用程序需要大量的元素:必须使用唯一的用户标识符存储信息,能够在用户再次访问时识别用户,然后根据需要获取用户信息。若要简化应用程序,可以 ......
Default.aspx CS文件代码
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _De ......
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="LeftMenu.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xht ......
Atlas是什么?
atlas 2006-12-12 09:48 阅读69 评论0
字号: 大大 中中 小小
Atlas是什么?
ASP.NET”Atlas”是一个新的Web技术开发包,它集成了一套非常大的客户端脚本库使得与功能丰富的、基于服务器开发平台的ASP.NET2.0结合在一起,&rdq ......