十天學會ASP.Net——(8)

1. ajax入門AJAX Extensions工具箱

(1)實現又刷新改變字體大小和無刷新改變字體大小

頁面設計:

clip_image002

前臺頁面設計:

首先需要在用到ajaxExtensions控件的位置之前放置一個ScriptManager控件,它將在瀏覽頁面時不可見,也不能提供其他功能,只是協助完成其他ajax控件需要完成的任務。

然后在UpdatePanel中加入需要實現無刷新的文本框和按鈕。又刷新的則放在外部。

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><asp:Label ID="Label2" runat="server" Text="測試更改字體大小"></asp:Label><br />無刷新:<asp:TextBox ID="TextBox2" runat="server" AutoPostBack="True" ontextchanged="TextBox2_TextChanged"></asp:TextBox></ContentTemplate></asp:UpdatePanel><asp:Label ID="Label1" runat="server" Text="測試更改字體大小"></asp:Label><br /><br />有刷新:<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True" ontextchanged="TextBox1_TextChanged"></asp:TextBox>
(autopostback設為true)<br />

后臺代碼:

protected void TextBox1_TextChanged(object sender, EventArgs e)
{Label1.Font.Size = Int32.Parse(TextBox1.Text);
}
protected void TextBox2_TextChanged(object sender, EventArgs e)
{Label2.Font.Size = Int32.Parse(TextBox2.Text);
}

(2)圖片緩沖顯示——UpdataProgress

頁面設計:

clip_image002[6]clip_image004

前臺注意要添加UpdataProgress,然后做好與UpdatePanel的鏈接

<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><asp:Image ID="Image1" runat="server" /><asp:Button ID="Button1" runat="server" Text="顯示圖片" οnclick="Button1_Click" /></ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress runat="server" AssociatedUpdatePanelID="UpdatePanel1"><ProgressTemplate><asp:Image ID="Image2" runat="server" ImageUrl="顯示Loading畫面圖地址,可以去百度下" /></ProgressTemplate>
</asp:UpdateProgress>

后臺做個延時:

using System.Threading;
protected void Button1_Click(object sender, EventArgs e)
{Thread.Sleep(3000);Image1.ImageUrl = "111.jpg";
}

(3)時間無刷新改變——Timer

clip_image002[8]

前臺:

<asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><asp:Timer ID="Timer1" runat="server" Interval="1000" ontick="Timer1_Tick"></asp:Timer><asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></ContentTemplate>
</asp:UpdatePanel>

后臺:

protected void Page_Load(object sender, EventArgs e)
{Label2.Text = DateTime.Now.ToLongTimeString();
}
protected void Timer1_Tick(object sender, EventArgs e)
{Label1.Text = DateTime.Now.ToLongTimeString();
}

轉載于:https://www.cnblogs.com/shenerguang/archive/2012/05/25/2517337.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/274790.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/274790.shtml
英文地址,請注明出處:http://en.pswp.cn/news/274790.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

聊聊 computed 影響性能的場景

大家好&#xff0c;我是若川。持續組織了8個月源碼共讀活動&#xff0c;感興趣的可以點此加我微信 ruochuan12 參與&#xff0c;每周大家一起學習200行左右的源碼&#xff0c;共同進步。同時極力推薦訂閱我寫的《學習源碼整體架構系列》 包含20余篇源碼文章。歷史面試系列前言在…

saej1929_(1929年-2020年)

saej1929Milton Glaser, the legendary graphic designer who co-founded New York Magazine, created the iconic ‘I ? NY’ logo, the psychedelic Bob Dylan poster, and the Brooklyn Brewery logo, passed away yesterday at the age of 91 on his birthday, June 26, 2…

Chap2-構造函數語意學

如果一個類沒有任何constructor&#xff0c;那么會有一個default constructor被隱式的聲明出來&#xff0c;一個implicit default constructor將是一個trivial&#xff08;無用的&#xff09;constructor。但是在某些情況下&#xff0c;implicit default constructor將是一個no…

【熱點】React18正式版發布,未來發展趨勢是?

大家好&#xff0c;我是若川。持續組織了8個月源碼共讀活動&#xff0c;感興趣的可以點此加我微信 ruochuan12 參與&#xff0c;每周大家一起學習200行左右的源碼&#xff0c;共同進步。同時極力推薦訂閱我寫的《學習源碼整體架構系列》 包含20余篇源碼文章。歷史面試系列2022年…

不要重新發明輪子_是否重新發明輪子

不要重新發明輪子Design is a profession that thrives on creativity. Us designers are constantly trying to innovate by thinking outside the box. We’ve seen design evolve across all sectors — print, digital, product, architecture etc. We have gone from type…

asp.net mvc批量刪除的實現

<form action"Index" method"post"> <div> {<table><thead> <tr> <th width"100">編號</th><th width"100">名字</th></tr></thead> <tbody> foreach (var…

點擊頁面元素,這個Vite插件竟然幫我打開了Vue組件文件!超級好用!

大家好&#xff0c;我是若川。持續組織了8個月源碼共讀活動&#xff0c;感興趣的可以點此加我微信 ruochuan12 參與&#xff0c;每周大家一起學習200行左右的源碼&#xff0c;共同進步。同時極力推薦訂閱我寫的《學習源碼整體架構系列》 包含20余篇源碼文章。歷史面試系列前言這…

shields 徽標_符號,標志,文字標記:徽標類型的綜合指南

shields 徽標Designers and non-designers alike struggle with common terminology when talking about brand marks, often using different terms interchangeably. When it comes to clarifying definitions, sometimes even the most seasoned professionals get confused…

【原創】SVM小結

理論基礎&#xff1a; 機器學習有三類基本的問題&#xff0c;即模式識別、函數逼近和概率密度估計&#xff0e; SVM有著嚴格的理論基礎&#xff0c;建立了一套較好的有限訓練樣本下機器學習的理論框架和通用方法。他與機器學習是密切相關的&#xff0c;很多理論甚至解決了機器學…

React 18 帶給我們的驚喜

大家好&#xff0c;我是若川。持續組織了8個月源碼共讀活動&#xff0c;感興趣的可以點此加我微信 ruochuan12 參與&#xff0c;每周大家一起學習200行左右的源碼&#xff0c;共同進步。同時極力推薦訂閱我寫的《學習源碼整體架構系列》 包含20余篇源碼文章。歷史面試系列這篇文…

建模心法(2)——邁出建模第一步

原文地址&#xff1a;http://www.cnblogs.com/1-2-3/archive/2008/08/04/model-method-part1.html 原文作者&#xff1a;景春雷 一錯再錯的這故事才精彩 ——樸樹 《我愛你再見》摘要 即使讀了再多的書、跟過再多的項目&#xff0c;…

Web:你知道我這十幾年是怎么過來的嗎?!

大家好&#xff0c;我是若川。持續組織了8個月源碼共讀活動&#xff0c;感興趣的可以點此加我微信 ruochuan12 參與&#xff0c;每周大家一起學習200行左右的源碼&#xff0c;共同進步。同時極力推薦訂閱我寫的《學習源碼整體架構系列》 包含20余篇源碼文章。歷史面試系列1989 …

設計師更高效_如何丟掉我的工作使我成為一名更好的設計師

設計師更高效I lost my job a few times early on in my design career. In the process of getting back up after a job loss, it has made me a better designer not only in terms of hard skills but the soft skills required to be more resilient and empathetic, whic…

【ASP.NET】登陸成功后如何跳轉到上一個頁面

當用戶瀏覽網頁的時候會在某個地方需要用戶登陸才能繼續瀏覽&#xff0c;用戶登陸之后會自動跳轉到剛剛瀏覽的頁面。這個步驟是怎么實現的呢&#xff1f;net小伙在查閱相關資料實踐之后終于明白了&#xff0c;其實很簡單&#xff0c;先分享給大家吧。 當用戶在瀏覽一個頁面的時…

4月,誠邀你參加源碼共讀,學會看源碼,打開新世界!開闊視野

大家好&#xff0c;我是若川。很多關注我的新朋友可能不知道我組織了源碼共讀活動~也有很多人不知道我是誰。有人以為我是80后。有人以為我是全職自媒體等等。若川的 2021 年度總結&#xff0c;彈指之間 這篇文章寫了我是16年畢業的&#xff0c;或許有些啟發。源碼共讀按照從易…

bt709和srgb_選擇用于多用途視頻編輯和色彩校正的顯示器— sRGB,DCI-P3,REC 709

bt709和srgb**Note from the author: if you enjoy this article, please follow me or this publication for more video production and marketing related content.****作者注&#xff1a;如果您喜歡本文&#xff0c;請關注我或此出版物以獲取更多與視頻制作和營銷相關的內容…

超4000人參加源碼共讀,喊你來一起學習成長~打開新世界

大家好&#xff0c;我是若川。很多關注我的新朋友可能不知道我組織了源碼共讀活動~也有很多人不知道我是誰。有人以為我是80后。有人以為我是全職自媒體等等。若川的 2021 年度總結&#xff0c;彈指之間 這篇文章寫了我是16年畢業的&#xff0c;或許有些啟發。源碼共讀按照從易…

figma設計_如何在Figma中構建設計入門套件(第二部分)

figma設計Figma教程 (Figma Tutorial) With this short, but informative Tutorial Series I aim to show you how to build the solid foundations of a powerful, and versatile Design Starter Kit, enabling you to start your next project in Figma faster than ever bef…

Hibernate 簡介(百度)

Hibernate是一個開放源代碼的對象關系映射框架&#xff0c;它對JDBC進行了非常輕量級的對象封裝&#xff0c;使得Java程序員可以隨心所欲的使用對象編程思維來操縱數據庫。 Hibernate可以應用在任何使用JDBC的場合&#xff0c;既可以在Java的客戶端程序使用&#xff0c;也可以在…

GitHub 最受歡迎的Top 20 JavaScript 項目

大家好&#xff0c;我是若川。持續組織了8個月源碼共讀活動&#xff0c;感興趣的可以點此加我微信 ruochuan12 參與&#xff0c;每周大家一起學習200行左右的源碼&#xff0c;共同進步。同時極力推薦訂閱我寫的《學習源碼整體架構系列》 包含20余篇源碼文章。歷史面試系列今天來…