ASPX.NET學習筆記—- 第一個ASPX.NET程式

來源:互聯網
上載者:User
 

概念:ASPX.Net是建立在微軟新一代.Net平台架構上,利用普通語言運行時(Common Language Runtime)在伺服器後端為使用者提供建立強大的企業級Web應用服務的編程架構。

優點:

 

與瀏覽器無關

方便設定端點、易於調試

編譯後執行,運行效果提高

豐富的控制項陳列庫

建立與專案檔同目錄下的解決方案(適用於普通系統)

步驟:
檔案——建立——項目——Visual Studio 解決方案(到此建立一個不包含項目的空解決方案)——在方案總管中,選中建立的接解決方案——右鍵——
添加——建立網站——點擊瀏覽,在開啟的對話方塊中,選中剛才所建的空解決方案路徑——在開啟的對話方塊中選中,在現有的位置建立新網站——單擊確定

建立與專案檔同目錄下的解決方案(適用於構建三層結構的系統)

步驟:
檔案——建立——項目——Visual Studio 解決方案(到此建立一個不包含項目的空解決方案)——在方案總管中,選中建立的解決方案——
在解決方案路徑後寫入 \檔案夾名——單擊確定即可

彈框提示

種類

文法

建立空白頁彈框

(1)Response.Write("<script>alert(\"使用者名稱或密碼錯誤!\");location.href='login.aspx';</script> ");
(2)Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "",
"<script>alert(\"
使用者名稱或密碼錯誤!\");location.href='login.aspx';</script> ");

在本頁彈框(註冊彈框)

(1)Page.ClientScript.RegisterStartupScript(this.GetType(), "",
"<script>alert(\"
使用者名稱或密碼錯誤!\");location.href='login.aspx';</script> ");
(2)
在頁面上添加一個Label控制項 this.Label控制項ID.Text = "<script>alert('正確!');</script>";(實現代碼)

    //對顯示的內容做處理(後置代碼中)
    public static string CutString(Object content, int num) {
        if (content.ToString().Length > num - 2)
        {
            return content.ToString().Substring(0, num - 2) + "...";
        }
        else {
            return content.ToString();
        }
    }

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.