色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

asp.net控件開發基礎(11)

  剛開篇的時后在最后把屬性值用視圖狀態來保存時,得以把當前狀態保存下來,關于視圖狀態的概述,這里不再累贅,沒了解過的朋友可以在MSDN里輸入視圖狀態概述了解一下.以下我們還是以以前講過的內容為例,一起繼續來改善控件的使用(第五篇和第九篇的例子)

  示例一

  我們啟用了跟蹤,按下確定按鈕后,控件屬性發生變化,按下無事件按鈕后,控件狀態則恢復到之前的狀態,而且在跟蹤狀態下發現Custom無視圖狀態.

<%@ Page Language="C#" Trace="true" %>
<%@ Register Assembly="CustomComponents" Namespace="CustomComponents" TagPrefix="custom" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Button1_Click(object sender, EventArgs e)
{
Custom1.Age
= 21;
Custom1.CustomMetier
= Metier.教師;
Custom1.CustomAddress.City
= "杭州";
Custom1.CustomAddress.State
= "中國";
Custom1.CustomAddress.Street
= "街道";
Custom1.CustomAddress.Zip
= "310000";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>無標題頁</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<custom:Custom ID="Custom1" runat="server">
</custom:Custom>
<br />
<br />
<ASP:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="確定" />
&nbsp; &nbsp;&nbsp;
<ASP:Button ID="Button2" runat="server" Text="無事件" />&nbsp;
</div>
</form>
</body>
</html>

NET技術asp.net控件開發基礎(11),轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 陇川县| 仁化县| 盱眙县| 澄江县| 高台县| 宜昌市| 叶城县| 大邑县| 进贤县| 怀仁县| 杨浦区| 理塘县| 金湖县| 紫金县| 依兰县| 鄢陵县| 老河口市| 黄浦区| 上栗县| 鸡西市| 吉安市| 建德市| 阳信县| 上犹县| 阜平县| 荃湾区| 兴宁市| 黑河市| 成安县| 元谋县| 汝南县| 静海县| 驻马店市| 朔州市| 沂水县| 祁连县| 山丹县| 滦平县| 青海省| 涞水县| 图木舒克市|