ScriptManager ScriptManager ScriptManager ScriptManager Class

定義

針對 Web 和應用程式服務的 ASP.NET Ajax 指令碼程式庫和指令碼檔、部分網頁的呈現作業和用戶端 Proxy 類別的產生作業進行管理。Manages ASP.NET Ajax script libraries and script files, partial-page rendering, and client proxy class generation for Web and application services.

public ref class ScriptManager : System::Web::UI::Control, System::Web::UI::IPostBackDataHandler, System::Web::UI::IPostBackEventHandler
[System.Drawing.ToolboxBitmap(typeof(EmbeddedResourceFinder), "System.Web.Resources.ScriptManager.bmp")]
public class ScriptManager : System.Web.UI.Control, System.Web.UI.IPostBackDataHandler, System.Web.UI.IPostBackEventHandler
type ScriptManager = class
    inherit Control
    interface IPostBackDataHandler
    interface IPostBackEventHandler
Public Class ScriptManager
Inherits Control
Implements IPostBackDataHandler, IPostBackEventHandler
繼承
ScriptManagerScriptManagerScriptManagerScriptManager
屬性
實作

範例

下列範例顯示使用ScriptManager控制項的不同案例。The following examples show different scenarios for using the ScriptManager control.

啟用部分頁面更新Enabling Partial-Page Updates

下列範例顯示如何使用ScriptManager控制項來啟用部分頁面更新。The following example shows how to use the ScriptManager control to enable partial-page updates. 在此範例中, Calendar DropDownList和控制項是在UpdatePanel控制項內。In this example, a Calendar and a DropDownList control are inside an UpdatePanel control. 根據預設, UpdateMode屬性的值為Always, ChildrenAsTriggers而屬性的值為trueBy default, the value of the UpdateMode property is Always, and the value of the ChildrenAsTriggers property is true. 因此, 面板的子控制項會造成非同步回傳。Therefore, child controls of the panel cause an asynchronous postback.


<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    void DropDownSelection_Change(Object sender, EventArgs e)
    {
        Calendar1.DayStyle.BackColor =
            System.Drawing.Color.FromName(ColorList.SelectedItem.Value);
    }

    protected void Calendar1_SelectionChanged(object sender, EventArgs e)
    {
        SelectedDate.Text = 
            Calendar1.SelectedDate.ToString();
    }

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>UpdatePanel Example</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" 
                               runat="server" />
            <asp:UpdatePanel ID="UpdatePanel1"
                             runat="server">
                <ContentTemplate>
                    <asp:Calendar ID="Calendar1" 
                                  ShowTitle="True"
                                  OnSelectionChanged="Calendar1_SelectionChanged"
                                  runat="server" />
                    <div>
                        Background:
                        <br />
                        <asp:DropDownList ID="ColorList" 
                                          AutoPostBack="True" 
                                          OnSelectedIndexChanged="DropDownSelection_Change"
                                          runat="server">
                            <asp:ListItem Selected="True" Value="White"> 
                            White </asp:ListItem>
                            <asp:ListItem Value="Silver"> 
                            Silver </asp:ListItem>
                            <asp:ListItem Value="DarkGray"> 
                            Dark Gray </asp:ListItem>
                            <asp:ListItem Value="Khaki"> 
                            Khaki </asp:ListItem>
                            <asp:ListItem Value="DarkKhaki"> D
                            ark Khaki </asp:ListItem>
                        </asp:DropDownList>
                    </div>
                    <br />
                    Selected date:
                    <asp:Label ID="SelectedDate" 
                               runat="server">None.</asp:Label>
                </ContentTemplate>
            </asp:UpdatePanel>
            <br />
        </div>
    </form>
</body>
</html>

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    Sub DropDownSelection_Change(ByVal Sender As Object, ByVal E As EventArgs)
        Calendar1.DayStyle.BackColor = _
        System.Drawing.Color.FromName(ColorList.SelectedItem.Value)
    End Sub

    Protected Sub Calendar1_SelectionChanged(ByVal Sender As Object, ByVal E As EventArgs)
        SelectedDate.Text = Calendar1.SelectedDate.ToString()
    End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>UpdatePanel Example</title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" 
                               runat="server" />
            <asp:UpdatePanel ID="UpdatePanel1"
                             runat="server">
                <ContentTemplate>
                    <asp:Calendar ID="Calendar1" 
                                  ShowTitle="True"
                                  OnSelectionChanged="Calendar1_SelectionChanged"
                                  runat="server" />
                    <div>
                        Background:
                        <br />
                        <asp:DropDownList ID="ColorList" 
                                          AutoPostBack="True" 
                                          OnSelectedIndexChanged="DropDownSelection_Change"
                                          runat="server">
                            <asp:ListItem Selected="True" Value="White"> 
                            White </asp:ListItem>
                            <asp:ListItem Value="Silver"> 
                            Silver </asp:ListItem>
                            <asp:ListItem Value="DarkGray"> 
                            Dark Gray </asp:ListItem>
                            <asp:ListItem Value="Khaki"> 
                            Khaki </asp:ListItem>
                            <asp:ListItem Value="DarkKhaki"> D
                            ark Khaki </asp:ListItem>
                        </asp:DropDownList>
                    </div>
                    <br />
                    Selected date:
                    <asp:Label ID="SelectedDate" 
                               runat="server">None.</asp:Label>
                </ContentTemplate>
            </asp:UpdatePanel>
            <br />
        </div>
    </form>
</body>
</html>

處理部分頁面更新錯誤和註冊腳本Handling Partial-Page Update Errors and Registering Script

下列範例顯示如何在部分頁面更新期間提供自訂錯誤處理。The following example shows how to provide custom error handling during partial-page updates. 根據預設, 在部分頁面更新期間發生錯誤時, 會顯示 JavaScript 訊息方塊。By default, when an error occurs during partial-page updates, a JavaScript message box is displayed. 這個範例示範如何藉由提供AsyncPostBackError事件的處理常式, 以及在事件處理常式中AsyncPostBackErrorMessage設定屬性, 來使用自訂錯誤處理。This example demonstrates how to use custom error handling by providing a handler for the AsyncPostBackError event, and by setting the AsyncPostBackErrorMessage property in the event handler. 您也可以設定AllowCustomErrorsRedirect屬性, 以指定在部分頁面更新期間發生錯誤時, 如何使用 web.config 檔案的自訂錯誤區段。You can also set the AllowCustomErrorsRedirect property to specify how the custom errors section of the Web.config file is used when an error occurs during partial-page updates. 在此範例中, 會使用AllowCustomErrorsRedirect屬性的預設值。In this example, the default value of the AllowCustomErrorsRedirect property is used. 這表示, 如果 Web.config 檔案包含customErrors元素, 該元素會決定錯誤的顯示方式。This means that if the Web.config file contains a customErrors element, that element determines how errors are displayed. 如需詳細資訊, 請參閱CustomErrors 元素 (ASP.NET 設定架構)For more information, see customErrors Element (ASP.NET Settings Schema).

<%@ Page Language="C#" %>

<!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)
    {
        try
        {
            int a = Int32.Parse(TextBox1.Text);
            int b = Int32.Parse(TextBox2.Text);
            int res = a / b;
            Label1.Text = res.ToString();
        }
        catch (Exception ex)
        {
            if (TextBox1.Text.Length > 0 && TextBox2.Text.Length > 0)
            {
                ex.Data["ExtraInfo"] = " You can't divide " +
                    TextBox1.Text + " by " + TextBox2.Text + ".";
            }
            throw ex;
        }
    }

    protected void ScriptManager1_AsyncPostBackError(object sender, AsyncPostBackErrorEventArgs e)
    {
        if (e.Exception.Data["ExtraInfo"] != null)
        {
            ScriptManager1.AsyncPostBackErrorMessage =
                e.Exception.Message +
                e.Exception.Data["ExtraInfo"].ToString();
        }
        else
        {
            ScriptManager1.AsyncPostBackErrorMessage =
                "An unspecified error occurred.";
        }
    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>UpdatePanel Error Handling Example</title>
    <style type="text/css">
    #UpdatePanel1 {
      width: 200px; height: 50px;
      border: solid 1px gray;
    }
    #AlertDiv{
    left: 40%; top: 40%;
    position: absolute; width: 200px;
    padding: 12px; 
    border: #000000 1px solid;
    background-color: white; 
    text-align: left;
    visibility: hidden;
    z-index: 99;
    }
    #AlertButtons{
    position: absolute; right: 5%; bottom: 5%;
    }
    </style>
</head>
<body id="bodytag">
    <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" 
            OnAsyncPostBackError="ScriptManager1_AsyncPostBackError" runat="server" >
            <Scripts>
            <asp:ScriptReference Path="ErrorHandling.js" />
            </Scripts>
            </asp:ScriptManager>
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Width="39px"></asp:TextBox>
                    /
                    <asp:TextBox ID="TextBox2" runat="server" Width="39px"></asp:TextBox>
                    =
                    <asp:Label ID="Label1" runat="server"></asp:Label><br />
                    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="calculate" />
                </ContentTemplate>
            </asp:UpdatePanel>
            <div id="AlertDiv">
                <div id="AlertMessage">
                </div>
                <br />
                <div id="AlertButtons">
                    <input id="OKButton" type="button" value="OK" runat="server" onclick="ClearErrorState()" />
                </div>
            </div>
        </div>
    </form>
</body>
</html>
<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Try
            Dim a As Int32
            a = Int32.Parse(TextBox1.Text)
            Dim b As Int32
            b = Int32.Parse(TextBox2.Text)
            Dim res As Int32 = a / b
            Label1.Text = res.ToString()
        Catch ex As Exception
            If (TextBox1.Text.Length > 0 AndAlso TextBox2.Text.Length > 0) Then
                ex.Data("ExtraInfo") = " You can't divide " & _
                  TextBox1.Text & " by " & TextBox2.Text & "."
            End If
            Throw ex
        End Try

    End Sub
    Protected Sub ScriptManager1_AsyncPostBackError(ByVal sender As Object, ByVal e As System.Web.UI.AsyncPostBackErrorEventArgs)
        If (e.Exception.Data("ExtraInfo") <> Nothing) Then
            ScriptManager1.AsyncPostBackErrorMessage = _
               e.Exception.Message & _
               e.Exception.Data("ExtraInfo").ToString()
        Else
            ScriptManager1.AsyncPostBackErrorMessage = _
               "An unspecified error occurred."
        End If
    End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>UpdatePanel Error Handling Example</title>
    <style type="text/css">
    #UpdatePanel1 {
      width: 200px; height: 50px;
      border: solid 1px gray;
    }
    #AlertDiv{
    left: 40%; top: 40%;
    position: absolute; width: 200px;
    padding: 12px; 
    border: #000000 1px solid;
    background-color: white; 
    text-align: left;
    visibility: hidden;
    z-index: 99;
    }
    #AlertButtons{
    position: absolute; right: 5%; bottom: 5%;
    }
    </style>
</head>
<body id="bodytag">
    <form id="form1" runat="server">
        <div>
            <asp:ScriptManager ID="ScriptManager1" 
            OnAsyncPostBackError="ScriptManager1_AsyncPostBackError" runat="server" >
            <Scripts>
            <asp:ScriptReference Path="ErrorHandling.js" />
            </Scripts>
            </asp:ScriptManager>

            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Width="39px"></asp:TextBox>
                    /
                    <asp:TextBox ID="TextBox2" runat="server" Width="39px"></asp:TextBox>
                    =
                    <asp:Label ID="Label1" runat="server"></asp:Label><br />
                    <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="calculate" />
                </ContentTemplate>
            </asp:UpdatePanel>
            <div id="AlertDiv">
                <div id="AlertMessage">
                </div>
                <br />
                <div id="AlertButtons">
                    <input id="OKButton" type="button" value="OK" runat="server" onclick="ClearErrorState()" />
                </div>
            </div>
        </div>
    </form>
</body>
</html>

全球化顯示在瀏覽器中的日期和時間Globalizing the Date and Time That Are Displayed in the Browser

下列範例示範如何設定EnableScriptGlobalization屬性, 讓用戶端腳本可以在瀏覽器中顯示特定文化特性的日期和時間。The following example shows how to set the EnableScriptGlobalization property so that client script can display a culture-specific date and time in the browser. 在此範例中, Culture @ Page指示詞的屬性會設定為autoIn the example, the Culture attribute of the @ Page directive is set to auto. 因此, 在目前的瀏覽器設定中指定的第一個語言, 會決定網頁的文化特性和 UI 文化特性。As a result, the first language that is specified in the current browser settings determines the culture and UI culture for the page. 如需詳細資訊,請參閱如何:設定 ASP.NET Web 網頁全球化的文化特性和 UI 文化特性。For more information, see How to: Set the Culture and UI Culture for ASP.NET Web Page Globalization.

<%@ Page Language="C#" Culture="auto" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Globalization Example</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" EnableScriptGlobalization="true" runat="server">
        </asp:ScriptManager>
        <script type="text/javascript">
        function pageLoad() {
          Sys.UI.DomEvent.addHandler($get("Button1"), "click", formatDate);
        }
        function formatDate() {
          var d = new Date();
          try {
            $get('Label1').innerHTML = d.localeFormat("dddd, dd MMMM yyyy HH:mm:ss");
          }
          catch(e) {
            alert("Error:" + e.message);
          }
        }
        </script>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional">
        <ContentTemplate>
        <asp:Panel ID="Panel1" runat="server" GroupingText="Update Panel">
        <asp:Button ID="Button1" runat="server" Text="Display Date" />

        <br />

        <asp:Label ID="Label1" runat="server"></asp:Label>
        </asp:Panel>
        </ContentTemplate>
        </asp:UpdatePanel>
    </form>
</body>
</html>
<%@ Page Language="VB" Culture="auto" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Globalization Example</title>
</head>
<body>
    <form id="form1" runat="server">
        <asp:ScriptManager ID="ScriptManager1" EnableScriptGlobalization="true" runat="server">
        </asp:ScriptManager>
        <script type="text/javascript">
        function pageLoad() {
          Sys.UI.DomEvent.addHandler($get("Button1"), "click", formatDate);
        }
        function formatDate() {
          var d = new Date();
          try {
            $get('Label1').innerHTML = d.localeFormat("dddd, dd MMMM yyyy HH:mm:ss");
          }
          catch(e) {
            alert("Error:" + e.message);
          }
        }
        </script>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional">
        <ContentTemplate>
        <asp:Panel ID="Panel1" runat="server" GroupingText="Update Panel">
        <asp:Button ID="Button1" runat="server" Text="Display Date" />

        <br />

        <asp:Label ID="Label1" runat="server"></asp:Label>
        </asp:Panel>
        </ContentTemplate>
        </asp:UpdatePanel>
    </form>
</body>
</html>

備註

本主題內容:In this topic:

簡介Introduction

ScriptManager控制項在 ASP.NET 中是 Ajax 功能的核心。The ScriptManager control is central to Ajax functionality in ASP.NET. 控制項會管理頁面上的所有 ASP.NET Ajax 資源。The control manages all ASP.NET Ajax resources on a page. 這包括將 Microsoft Ajax Library 腳本下載至瀏覽器, 以及協調使用UpdatePanel控制項啟用的部分頁面更新。This includes downloading Microsoft Ajax Library scripts to the browser and coordinating partial-page updates that are enabled by using UpdatePanel controls. 此外, 此ScriptManager控制項可讓您執行下列動作:In addition, the ScriptManager control enables you to do the following:

  • 註冊與部分頁面更新相容的腳本。Register script that is compatible with partial-page updates. 為了管理您的腳本與核心程式庫之間的相依性, 您註冊的任何腳本都會在 Microsoft Ajax Library 腳本之後載入。In order to manage dependencies between your script and the core library, any script that you register is loaded after the Microsoft Ajax Library script.

  • 指定發行或調試腳本是否要傳送至瀏覽器。Specify whether release or debug scripts are sent to the browser.

  • 藉由向ScriptManager控制項註冊 web 服務, 從腳本提供 web 服務方法的存取權。Provide access to Web service methods from script by registering Web services with the ScriptManager control.

  • ScriptManager控制項註冊這些服務, 以提供從用戶端腳本 ASP.NET 驗證、角色和設定檔應用程式服務的存取權。Provide access to ASP.NET authentication, role, and profile application services from client script by registering these services with the ScriptManager control.

  • 在瀏覽器中啟用 ECMAScript (JavaScript)、和字串函式的特定文化特性顯示。Enable culture-specific display of ECMAScript (JavaScript) , , and String functions in the browser.

  • 使用ResourceUICultures ScriptReference控制項的屬性, 存取內嵌腳本檔案或獨立腳本檔案的當地語系化資源。Access localization resources for embedded script files or for stand-alone script files by using the ResourceUICultures property of the ScriptReference control.

  • IExtenderControl ScriptManager控制項註冊執行或IScriptControl介面的伺服器控制項, 以便呈現用戶端元件和行為所需的腳本。Register server controls that implement the IExtenderControl or IScriptControl interfaces with the ScriptManager control so that script required by client components and behaviors is rendered.

部分頁面呈現Partial-Page Rendering

ASP.NET 網頁支援部分頁面呈現的功能, 是由下列因素控制:The ability of an ASP.NET page to support partial-page rendering is controlled by the following factors:

您可以在執行時間, 或EnablePartialRendering在頁面的Init事件之前, 覆寫屬性的值。You can override the value of the EnablePartialRendering property at run time during or before the page's Init event. 如果您嘗試在頁面Init事件發生後變更此屬性InvalidOperationException , 則會擲回例外狀況。If you try to change this property after the page's Init event has occurred, an InvalidOperationException exception is thrown.

當支援部分頁面轉譯時, ScriptManager控制項會呈現腳本來啟用非同步回傳和部分頁面更新。When partial-page rendering is supported, the ScriptManager control renders script to enable asynchronous postbacks and partial-page updates. 要更新的網頁區域是使用UpdatePanel控制項所指定。The regions of the page to be updated are designated by using UpdatePanel controls. ScriptManager控制項會處理非同步回傳, 而且只會重新整理必須更新的頁面區域。The ScriptManager control handles the asynchronous postbacks and refreshes only the regions of the page that have to be updated. 如需部分頁面呈現的詳細資訊, 請參閱部分頁面轉譯總覽For more information about partial-page rendering, see Partial-Page Rendering Overview. 如需有關導致更新之條件的詳細資訊, 請參閱UpdatePanel 控制項總覽For more information about the conditions that cause an update, see UpdatePanel Control Overview.

搭配主版頁面、使用者控制項和其他子元件使用 ScriptManager 控制項Using the ScriptManager Control with Master Pages, User Controls, and Other Child Components

頁面在其階層中只能ScriptManager包含一個控制項。A page can contain only one ScriptManager control in its hierarchy. 若要在父頁面已經有ScriptManager控制項時, 針對嵌套頁面、使用者控制項或元件註冊服務和腳本, 請ScriptManagerProxy使用控制項。To register services and scripts for nested pages, user controls, or components when the parent page already has a ScriptManager control, use the ScriptManagerProxy control. 如需詳細資訊, 請參閱搭配使用 UpdatePanel 控制項與主版頁面For more information, see Using the UpdatePanel Control with Master Pages

腳本管理與註冊Script Management and Registration

ScriptManager控制項可讓您註冊腳本, 然後再轉譯成頁面的一部分。The ScriptManager control enables you to register script that is then rendered as part of the page. ScriptManager控制項註冊方法可以分成下列三個類別:The ScriptManager control registration methods can be broken into the following three categories:

  • 保證會維護 Microsoft Ajax Library 上的腳本相依性的註冊方法。Registration methods that guarantee that script dependencies on the Microsoft Ajax Library are maintained.

  • 不相依于 Microsoft Ajax Library 但與UpdatePanel控制項相容的註冊方法。Registration methods that are not dependent on the Microsoft Ajax Library, but that are compatible with UpdatePanel controls.

  • 支援UpdatePanel使用控制項的註冊方法。Registration methods that support working with UpdatePanel controls.

如需如何在 ASP.NET 中建立和使用 Ajax 腳本的詳細資訊, 請參閱使用 Microsoft Ajax Library 建立自訂用戶端腳本For more information about how to create and use Ajax script in ASP.NET, see Creating Custom Client Script by Using the Microsoft Ajax Library.

註冊相依于 Microsoft Ajax Library 的腳本Registering Script That Is Dependent on the Microsoft Ajax Library

您可以使用下列方法, 以確保維護 Microsoft Ajax Library 上任何相依性的方式來註冊腳本檔案。You can use the following methods to register script files in a way that guarantees that any dependencies on the Microsoft Ajax Library are maintained.

方法Method 定義Definition
RegisterScriptControl 註冊伺服器控制項, 其可執行IScriptControl用來定義Sys 元件用戶端物件的介面。Registers a server control that implements the IScriptControl interface that is used to define a Sys.Component client object. ScriptManager控制項會呈現支援用戶端物件的腳本。The ScriptManager control renders script that supports the client object.
RegisterExtenderControl 註冊伺服器控制項, 其可執行IExtenderControl用來定義Sys 元件用戶端物件的介面。Registers a server control that implements the IExtenderControl interface that is used to define a Sys.Component client object. ScriptManager控制項會呈現支援用戶端物件的腳本。The ScriptManager control renders script that supports the client object.

註冊部分頁面更新相容的腳本Registering Partial-Page Update Compatible Scripts

您可以使用下列方法來註冊不相依于 Microsoft Ajax Library 但與UpdatePanel控制項相容的腳本檔案。You can use the following methods to register script files that are not dependent on the Microsoft Ajax Library but that are compatible with UpdatePanel controls. 這些方法對應至ClientScriptManager控制項的類似方法。These methods correspond to similar methods of the ClientScriptManager control. 如果您要轉譯要在UpdatePanel控制項內使用的腳本, 請務必呼叫ScriptManager控制項的方法。If you are rendering script for use inside an UpdatePanel control, make sure that you call the methods of the ScriptManager control.

方法Method 定義Definition
RegisterArrayDeclaration 將值加入至 JavaScript 陣列。Adds a value to a JavaScript array. 如果陣列不存在, 則會建立它。If the array does not exist, it is created.
RegisterClientScriptBlock 在頁面的開頭<form>標記之後呈現元素。scriptRenders a script element after the page's opening <form> tag. 腳本會指定為字串參數。The script is specified as a string parameter.
RegisterClientScriptInclude 在頁面的開頭<form>標記之後呈現元素。scriptRenders a script element after the page's opening <form> tag. 藉由將src屬性設定為指向腳本檔案的 URL, 即可指定腳本內容。The script content is specified by setting the src attribute to a URL that points to a script file.
RegisterClientScriptResource 在頁面的開頭<form>標記之後呈現元素。scriptRenders a script element after the page's opening <form> tag. 腳本內容是以元件中的資源名稱指定。The script content is specified with a resource name in an assembly. src屬性會自動填入 URL, 方法是呼叫從元件抓取已命名腳本的 HTTP 處理常式。The src attribute is automatically populated with a URL by a call to an HTTP handler that retrieves the named script from the assembly.
RegisterExpandoAttribute 在指定控制項的標記中, 呈現自訂名稱/值屬性組 (expando)。Renders a custom name/value attribute pair (an expando) in the markup for a specified control.
RegisterHiddenField 呈現隱藏的欄位。Renders a hidden field.
RegisterOnSubmitStatement 註冊為了回應form專案的submit事件而執行的腳本。Registers a script that is executed in response to the form element's submit event. onSubmit屬性會參考指定的腳本。The onSubmit attribute references the specified script.
RegisterStartupScript 在頁面結尾</form>標記的正前面呈現啟動腳本區塊。Renders a startup script block just before the page's closing </form> tag. 要轉譯的腳本會指定為字串參數。The script to render is specified as a string parameter.

當您註冊方法時, 您可以為該腳本指定類型/金鑰組。When you register methods, you specify a type/key pair for that script. 如果已經註冊具有相同類型/金鑰組的腳本, 就不會註冊新的腳本。If a script with the same type/key pair is already registered, a new script is not registered. 同樣地, 如果您使用已經存在的類型/資源名稱組來註冊腳本, script則不會再次新增參考資源的元素。Similarly, if you register a script with a type/resource name pair that already exists, the script element that references the resource is not added again. 當您註冊先前註冊之屬性的 expando 屬性時, 會擲回例外狀況。When you register an expando attribute of a previously registered attribute, an exception is thrown. 允許重複註冊陣列值。Duplicate registration of array values is allowed.

當您呼叫RegisterClientScriptInclude RegisterClientScriptResource或方法時, 請避免註冊執行內嵌函數的腳本。When you call the RegisterClientScriptInclude or the RegisterClientScriptResource method, avoid registering script that executes inline functions. 請改為註冊包含函式定義的腳本, 例如應用程式的事件處理常式或自訂類別定義。Instead, register script that contains function definitions like event handlers or custom class definitions for your application.

UpdatePanel 控制項的註冊方法Registration Methods for UpdatePanel Controls

當您使用UpdatePanel控制項時, 可以使用下列方法自訂部分頁面更新。You can use the following methods to customize partial-page updates when you use UpdatePanel controls.

方法Method 定義Definition
RegisterAsyncPostBackControl 將控制項註冊為非同步回傳的觸發程序。Registers a control as a trigger for asynchronous postbacks.
RegisterDataItem 在部分網頁的呈現過程中傳送自訂資料至控制項。Sends custom data to controls during partial-page rendering.
RegisterDispose UpdatePanel控制項內的控制項註冊 dispose 腳本。Registers a dispose script for a control that is inside an UpdatePanel control. 更新或刪除 UpdatePanel 控制項時,便會執行該指令碼。The script is executed when the UpdatePanel control is updated or deleted. Dispose 方法用於屬於 Microsoft Ajax Library 的用戶端元件, 而且當元件不再使用時, 必須釋放資源。The dispose method is used for client components that are part of the Microsoft Ajax Library and that have to free resources when a component is no longer used.
RegisterPostBackControl 將控制項註冊為完整回傳的觸發程式。Registers a control as a trigger for a full postback. 這個方法會用於UpdatePanel控制項內的控制項, 否則會執行非同步回傳。This method is used for controls inside an UpdatePanel control that would otherwise perform asynchronous postbacks.

Web 服務參考Web Service References

您可以註冊要從用戶端腳本呼叫的 Web 服務, 方法是ServiceReference建立物件, 並將它Services加入至ScriptManager控制項的集合。You can register a Web service to be called from client script by creating a ServiceReference object and adding it to the Services collection of the ScriptManager control. ASP.NET 會為Services集合中的每個ServiceReference物件產生用戶端 proxy 物件。ASP.NET generates a client proxy object for each ServiceReference object in the Services collection. 您可以透過程式ServiceReference設計的Services方式, 將物件加入至集合, 以便在執行時間註冊 Web 服務。You can programmatically add ServiceReference objects to the Services collection to register Web services at run time.

如需如何在腳本中存取 Web 服務的詳細資訊, 請參閱在 ASP.NET ajax 中將 Web 服務公開給用戶端腳本在 ASP.NET Ajax 中從用戶端腳本呼叫 web 服務For more information about how to access Web services in script, see Exposing Web Services to Client Script in ASP.NET AJAX and Calling Web Services from Client Script in ASP.NET AJAX.

當地語系化Localization

ScriptManager控制項會在轉譯的頁面中產生參考, 這些檔案指向適當的當地語系化腳本檔案, 也就是內嵌在元件或獨立腳本檔案中的腳本檔案。The ScriptManager control generates references in the rendered page that point to the appropriate localized script files, which are either script files embedded in assemblies or stand-alone script files.

當屬性設定為true時, ScriptManager控制項會抓取目前文化特性的當地語系化資源 (例如當地語系化的字串) (如果有的話)。 EnableScriptLocalizationWhen the EnableScriptLocalization property is set to true, the ScriptManager control retrieves localized resources (such as localized strings) for the current culture, if they exist. ScriptManager控制項提供下列使用當地語系化資源的功能:The ScriptManager control provides the following functionality for using localized resources:

  • 內嵌在元件中的腳本檔案。Script files that are embedded in an assembly. ScriptManager控制項會判斷要傳送至瀏覽器的文化特性特定或回溯文化特性腳本檔案。The ScriptManager control determines which culture-specific or fallback-culture script file to send to the browser. 它會使用特定NeutralResourcesLanguageAttribute文化特性元件屬性、與元件一起封裝的資源, 以及瀏覽器的 UI 文化特性 (如果有的話) 來完成這項工作。It does this by using the culture-specific NeutralResourcesLanguageAttribute assembly attribute, the resources packaged with the assembly, and the UI culture of the browser (if any).

  • 獨立的腳本檔案。Stand-alone script files. 控制項會定義使用ScriptReference物件的ResourceUICultures屬性所支援的 UI 文化特性清單。 ScriptManagerThe ScriptManager control defines the list of UI cultures that are supported by using the ResourceUICultures property of the ScriptReference object.

  • 在 [偵錯模式] 中In debug mode. ScriptManager控制項會嘗試轉譯包含偵錯工具資訊的特定文化特性腳本檔案。The ScriptManager control tries to render a culture-specific script file that contains debug information. 例如, 如果頁面處於 [偵錯工具] 模式, 而 [目前文化特性] 設定為 [en-us], 則控制項會轉譯具有名稱 (例如scriptname. en-MX) 的腳本檔案 (如果檔案存在的話)。For example, if the page is in debug mode and the current culture is set to en-MX, the control renders a script file that has a name such as scriptname.en-MX.debug.js, if the file exists. 如果檔案不存在, 則會轉譯適當回溯文化特性的偵錯工具檔案If the file does not exist, the debug file for the appropriate fallback culture is rendered

如需如何將資源當地語系化的詳細資訊, 請參閱當地語系化元件庫的資源總覽For more information about how to localize resources, see Localizing Resources for Component Libraries Overview.

錯誤處理Error Handling

在非同步回傳期間發生分頁錯誤時, AsyncPostBackError會引發事件。When a page error occurs during asynchronous postbacks, the AsyncPostBackError event is raised. 伺服器上的錯誤傳送至用戶端的方式AllowCustomErrorsRedirect AsyncPostBackErrorMessage , 取決於屬性、屬性和 web.config 檔案的自訂錯誤區段。The way in which errors on the server are sent to the client depends on the AllowCustomErrorsRedirect property, the AsyncPostBackErrorMessage property, and the custom errors section of the Web.config file. 如需詳細資訊, 請參閱自訂 UpdatePanel 控制項的錯誤處理For more information, see Customizing Error Handling for UpdatePanel Controls.

宣告式語法Declarative Syntax

<asp:ScriptManager  
    AllowCustomErrorsRedirect="True|False"  
    AsyncPostBackErrorMessage="string"  
    AsyncPostBackTimeout="integer"  
    AuthenticationService-Path="uri"  
    EnablePageMethods="True|False"  
    EnablePartialRendering="True|False"  
    EnableScriptGlobalization="True|False"  
    EnableScriptLocalization="True|False"  
    EnableTheming="True|False"  
    EnableViewState="True|False"  
    ID="string"  
    LoadScriptsBeforeUI="True|False"  
    OnAsyncPostBackError="AsyncPostBackError event handler"  
    OnDataBinding="DataBinding event handler"  
    OnDisposed="Disposed event handler"  
    OnInit="Init event handler"  
    OnLoad="Load event handler"  
    OnPreRender="PreRender event handler"  
    OnResolveScriptReference="ResolveScriptReference event handler"  
    OnUnload="Unload event handler"  
    ProfileService-LoadProperties="string"  
    ProfileService-Path="uri"  
    RoleService-LoadRoles="True|False"  
    RoleService-Path="uri"  
    runat="server"  
    ScriptMode="Auto|Inherit|Debug|Release"  
    ScriptPath="string"  
    SkinID="string"  
    SupportsPartialRendering="True|False"  
    Visible="True|False"  
>  
        <AuthenticationService  
            Path="uri"  
        />  
        <ProfileService  
            LoadProperties="string"  
            Path="uri"  
        />  
        <RoleService  
            LoadRoles="True|False"  
            Path="uri"  
        />  
        <Scripts>  
            <asp:ScriptReference  
                Assembly="string"  
                IgnoreScriptPath="True|False"  
                Name="string"  
                NotifyScriptLoaded="True|False"  
                Path="string"  
                ResourceUICultures="string"  
                ScriptMode="Auto|Debug|Inherit|Release"  
            />  
        </Scripts>  
        <Services>  
            <asp:ServiceReference  
                InlineScript="True|False"  
                Path="string"  
            />  
        </Services>  
</asp:ScriptManager>  

建構函式

ScriptManager() ScriptManager() ScriptManager() ScriptManager()

初始化 ScriptManager 類別的新執行個體。Initializes a new instance of the ScriptManager class.

屬性

Adapter Adapter Adapter Adapter

針對控制項取得瀏覽器的特定配置器。Gets the browser-specific adapter for the control.

(Inherited from Control)
AjaxFrameworkAssembly AjaxFrameworkAssembly AjaxFrameworkAssembly AjaxFrameworkAssembly

取得網頁上元件所使用的 Ajax 架構組件。Gets the Ajax framework assembly that components on the page use.

AjaxFrameworkMode AjaxFrameworkMode AjaxFrameworkMode AjaxFrameworkMode

取得或設定值,該值指出如何將 Microsoft Ajax 用戶端程式庫的用戶端指令碼包含在用戶端中。Gets or sets a value that specifies how client scripts of the Microsoft Ajax client library will be included on the client.

AllowCustomErrorsRedirect AllowCustomErrorsRedirect AllowCustomErrorsRedirect AllowCustomErrorsRedirect

取得或設定值,這個值決定是否在非同步回傳期間使用 Web.config 檔案的自訂錯誤區段。Gets or sets a value that determines whether the custom errors section of the Web.config file is used during an error in an asynchronous postback.

AppRelativeTemplateSourceDirectory AppRelativeTemplateSourceDirectory AppRelativeTemplateSourceDirectory AppRelativeTemplateSourceDirectory

取得或設定包含了此控制項之 PageUserControl 物件的相對應用程式虛擬目錄。Gets or sets the application-relative virtual directory of the Page or UserControl object that contains this control.

(Inherited from Control)
AsyncPostBackErrorMessage AsyncPostBackErrorMessage AsyncPostBackErrorMessage AsyncPostBackErrorMessage

取得或設定錯誤訊息,在非同步回傳期間發生未處理的伺服器例外狀況時,會將該錯誤訊息傳送至用戶端。Gets or sets the error message that is sent to the client when an unhandled server exception occurs during an asynchronous postback.

AsyncPostBackSourceElementID AsyncPostBackSourceElementID AsyncPostBackSourceElementID AsyncPostBackSourceElementID

取得導致非同步回傳之控制項的唯一 ID。Gets the unique ID of the control that caused the asynchronous postback.

AsyncPostBackTimeout AsyncPostBackTimeout AsyncPostBackTimeout AsyncPostBackTimeout

取得或設定值,這個值表示未收到任何回應時非同步回傳逾時之前的時間 (以秒為單位)。Gets or sets a value that indicates the time, in seconds, before asynchronous postbacks time out if no response is received.

AuthenticationService AuthenticationService AuthenticationService AuthenticationService

取得與目前 AuthenticationServiceManager 執行個體關聯的 ScriptManager 物件。Gets the AuthenticationServiceManager object that is associated with the current ScriptManager instance.

BindingContainer BindingContainer BindingContainer BindingContainer

取得包含了此控制項之資料繫結的控制項。Gets the control that contains this control's data binding.

(Inherited from Control)
ChildControlsCreated ChildControlsCreated ChildControlsCreated ChildControlsCreated

取得值,指出是否已經建立伺服器控制項的子控制項。Gets a value that indicates whether the server control's child controls have been created.

(Inherited from Control)
ClientID ClientID ClientID ClientID

取得 ASP.NET 所產生之 HTML 標記的控制項識別碼。Gets the control ID for HTML markup that is generated by ASP.NET.

(Inherited from Control)
ClientIDMode ClientIDMode ClientIDMode ClientIDMode

取得或設定用來產生 ClientID 屬性值的演算法。Gets or sets the algorithm that is used to generate the value of the ClientID property.

(Inherited from Control)
ClientIDSeparator ClientIDSeparator ClientIDSeparator ClientIDSeparator

取得字元值,表示在 ClientID 屬性中所使用的分隔字元。Gets a character value representing the separator character used in the ClientID property.

(Inherited from Control)
ClientNavigateHandler ClientNavigateHandler ClientNavigateHandler ClientNavigateHandler

取得或設定方法的名稱,該方法會處理用戶端上的 Sys.Application.navigate 事件。Gets or sets the name of the method that handles the Sys.Application.navigate event on the client.

CompositeScript CompositeScript CompositeScript CompositeScript

取得支援網頁之複合指令碼的參考。Gets a reference to the composite script that supports the Web page.

Context Context Context Context

取得與目前 Web 要求的伺服器控制項關聯的 HttpContext 物件。Gets the HttpContext object associated with the server control for the current Web request.

(Inherited from Control)
Controls Controls Controls Controls

取得 ControlCollection 物件,表示 UI 階層架構中指定之伺服器控制項的子控制項。Gets a ControlCollection object that represents the child controls for a specified server control in the UI hierarchy.

(Inherited from Control)
DataItemContainer DataItemContainer DataItemContainer DataItemContainer

如果命名容器實作 IDataItemContainer,則取得命名容器的參考。Gets a reference to the naming container if the naming container implements IDataItemContainer.

(Inherited from Control)
DataKeysContainer DataKeysContainer DataKeysContainer DataKeysContainer

如果命名容器實作 IDataKeysControl,則取得命名容器的參考。Gets a reference to the naming container if the naming container implements IDataKeysControl.

(Inherited from Control)
DesignMode DesignMode DesignMode DesignMode

取得值,指出控制項是否正用於設計介面上。Gets a value indicating whether a control is being used on a design surface.

(Inherited from Control)
EmptyPageUrl EmptyPageUrl EmptyPageUrl EmptyPageUrl

取得或設定空白網頁的 URL。Gets or sets a URL to a blank Web page.

EnableCdn EnableCdn EnableCdn EnableCdn

判斷目前網頁是否從內容提供網路 (Content Delivery Network,CDN) 路徑載入用戶端指令碼參考。Determines whether the current page loads client script references from CDN (Content Delivery Network) paths.

EnableCdnFallback EnableCdnFallback EnableCdnFallback EnableCdnFallback

可讓指令碼的本機複本在發生 CDN (內容傳遞網路) 無法使用的事件時載入。Enables local copy of a script to load in the event that the CDN (Content Delivery Network) is unavailable.

EnableHistory EnableHistory EnableHistory EnableHistory

取得或設定值,這個值指示網頁否支援記錄點管理。Gets or sets a value that indicates whether the Web page supports history point management.

EnablePageMethods EnablePageMethods EnablePageMethods EnablePageMethods

取得或設定值,這個值表示是否可以從用戶端指令碼呼叫 ASP.NET 網頁中的公用靜態網頁方法。Gets or sets a value that indicates whether public static page methods in an ASP.NET page can be called from client script.

EnablePartialRendering EnablePartialRendering EnablePartialRendering EnablePartialRendering

取得或設定值,這個值會啟用部分網頁呈現,而此功能可讓您使用 UpdatePanel 控制項,個別更新網頁的區域。Gets or sets a value that enables partial rendering of a page, which in turn enables you to update regions of the page individually by using UpdatePanel controls.

EnableScriptGlobalization EnableScriptGlobalization EnableScriptGlobalization EnableScriptGlobalization

取得或設定值,這個值表示 ScriptManager 控制項呈現的指令碼是否支援格式化和剖析文化特性資訊。Gets or sets a value that indicates whether the ScriptManager control renders script that supports parsing and formatting of culture-specific information.

EnableScriptLocalization EnableScriptLocalization EnableScriptLocalization EnableScriptLocalization

取得或設定值,這個值表示 ScriptManager 控制項是否呈現當地語系化版本的指令碼檔。Gets or sets a value that indicates whether the ScriptManager control renders localized versions of script files.

EnableSecureHistoryState EnableSecureHistoryState EnableSecureHistoryState EnableSecureHistoryState

取得或設定值,這個值指示是否要將記錄狀態字串加密。Gets or sets a value that indicates whether to encrypt the history state string.

EnableTheming EnableTheming EnableTheming EnableTheming

取得或設定值,指出佈景主題是否套用至此控制項。Gets or sets a value indicating whether themes apply to this control.

(Inherited from Control)
EnableViewState EnableViewState EnableViewState EnableViewState

取得或設定值,該值表示伺服器控制項是否對要求的用戶端而言保持其檢視狀態,以及它包含的任何子控制項狀態。Gets or sets a value indicating whether the server control persists its view state, and the view state of any child controls it contains, to the requesting client.

(Inherited from Control)
Events Events Events Events

取得控制項事件處理常式委派 (Delegate) 的清單。Gets a list of event handler delegates for the control. 這個屬性是唯讀的。This property is read-only.

(Inherited from Control)
HasChildViewState HasChildViewState HasChildViewState HasChildViewState

取得值,指出目前伺服器控制項的子控制項是否有任何已儲存的檢視狀態設定。Gets a value indicating whether the current server control's child controls have any saved view-state settings.

(Inherited from Control)
IControlBuilderAccessor.ControlBuilder IControlBuilderAccessor.ControlBuilder IControlBuilderAccessor.ControlBuilder IControlBuilderAccessor.ControlBuilder

如需這個成員的說明,請參閱 ControlBuilderFor a description of this member, see ControlBuilder.

(Inherited from Control)
IControlDesignerAccessor.UserData IControlDesignerAccessor.UserData IControlDesignerAccessor.UserData IControlDesignerAccessor.UserData

如需這個成員的說明,請參閱 UserDataFor a description of this member, see UserData.

(Inherited from Control)
ID ID ID ID

取得或設定指派給伺服器控制項的程式設計識別項。Gets or sets the programmatic identifier assigned to the server control.

(Inherited from Control)
IDataBindingsAccessor.DataBindings IDataBindingsAccessor.DataBindings IDataBindingsAccessor.DataBindings IDataBindingsAccessor.DataBindings

如需這個成員的說明,請參閱 DataBindingsFor a description of this member, see DataBindings.

(Inherited from Control)
IDataBindingsAccessor.HasDataBindings IDataBindingsAccessor.HasDataBindings IDataBindingsAccessor.HasDataBindings IDataBindingsAccessor.HasDataBindings

如需這個成員的說明,請參閱 HasDataBindingsFor a description of this member, see HasDataBindings.

(Inherited from Control)
IdSeparator IdSeparator IdSeparator IdSeparator

取得用來分隔控制項識別項的字元。Gets the character used to separate control identifiers.

(Inherited from Control)
IExpressionsAccessor.Expressions IExpressionsAccessor.Expressions IExpressionsAccessor.Expressions IExpressionsAccessor.Expressions

如需這個成員的說明,請參閱 ExpressionsFor a description of this member, see Expressions.

(Inherited from Control)
IExpressionsAccessor.HasExpressions IExpressionsAccessor.HasExpressions IExpressionsAccessor.HasExpressions IExpressionsAccessor.HasExpressions

如需這個成員的說明,請參閱 HasExpressionsFor a description of this member, see HasExpressions.

(Inherited from Control)
IsChildControlStateCleared IsChildControlStateCleared IsChildControlStateCleared IsChildControlStateCleared

取得值,指出這個控制項中所包含的控制項是否有控制項狀態。Gets a value indicating whether controls contained within this control have control state.

(Inherited from Control)
IsDebuggingEnabled IsDebuggingEnabled IsDebuggingEnabled IsDebuggingEnabled

取得值,這個值表示是否會呈現用戶端指令碼程式庫的偵錯版本。Gets a value that indicates whether the debug versions of client script libraries will be rendered.

IsInAsyncPostBack IsInAsyncPostBack IsInAsyncPostBack IsInAsyncPostBack

取得值,這個值表示目前的回傳是否正在部分呈現模式下執行。Gets a value that indicates whether the current postback is being executed in partial-rendering mode.

IsNavigating IsNavigating IsNavigating IsNavigating

取得值,這個值指示是否正在處理 Navigate 事件。Gets a value that indicates whether a Navigate event is currently being handled.

IsTrackingViewState IsTrackingViewState IsTrackingViewState IsTrackingViewState

取得值,指出伺服器控制項是否正在儲存檢視狀態的變更。Gets a value that indicates whether the server control is saving changes to its view state.

(Inherited from Control)
IsViewStateEnabled IsViewStateEnabled IsViewStateEnabled IsViewStateEnabled

取得值,指出這個控制項是否已啟用檢視狀態。Gets a value indicating whether view state is enabled for this control.

(Inherited from Control)
LoadScriptsBeforeUI LoadScriptsBeforeUI LoadScriptsBeforeUI LoadScriptsBeforeUI

取得或設定值,這個值表示是在載入網頁 UI 的標記之前還是之後載入指令碼。Gets or sets a value that indicates whether scripts are loaded before or after markup for the page UI is loaded.

LoadViewStateByID LoadViewStateByID LoadViewStateByID LoadViewStateByID

取得值,指出控制項是否依 ID (而不是索引) 參與載入其檢視狀態。Gets a value indicating whether the control participates in loading its view state by ID instead of index.

(Inherited from Control)
NamingContainer NamingContainer NamingContainer NamingContainer

取得伺服器控制項命名容器的參考,其建立唯一命名空間,在具有相同 ID 屬性值的伺服器控制項之間作區別。Gets a reference to the server control's naming container, which creates a unique namespace for differentiating between server controls with the same ID property value.

(Inherited from Control)
Page Page Page Page

取得含有伺服器控制項的 Page 執行個體的參考。Gets a reference to the Page instance that contains the server control.

(Inherited from Control)
Parent Parent Parent Parent

在網頁控制階層架構中取得伺服器控制項之父控制項的參考。Gets a reference to the server control's parent control in the page control hierarchy.

(Inherited from Control)
ProfileService ProfileService ProfileService ProfileService

取得與目前 ProfileServiceManager 執行個體關聯的 ScriptManager 物件。Gets the ProfileServiceManager object that is associated with the current ScriptManager instance.

RenderingCompatibility RenderingCompatibility RenderingCompatibility RenderingCompatibility

取得值,這個值會指定將與呈現 HTML 相容的 ASP.NET 版本。Gets a value that specifies the ASP.NET version that rendered HTML will be compatible with.

(Inherited from Control)
RoleService RoleService RoleService RoleService

取得與目前 RoleServiceManager 執行個體關聯的 ScriptManager 物件。Gets the RoleServiceManager object that is associated with the current ScriptManager instance.

ScriptMode ScriptMode ScriptMode ScriptMode

取得或設定值,這個值指定是呈現用戶端指令碼程式庫的偵錯版本,還是發行版本。Gets or sets a value that specifies whether debug or release versions of client script libraries are rendered.

ScriptPath ScriptPath ScriptPath ScriptPath

取得或設定位置的根路徑,這個路徑可用來建置 ASP.NET Ajax 和自訂指令碼檔的路徑。Gets or sets the root path of the location that is used to build the paths to ASP.NET Ajax and custom script files.

ScriptResourceMapping ScriptResourceMapping ScriptResourceMapping ScriptResourceMapping

取得 ScriptResourceMapping 物件。Gets a ScriptResourceMapping object.

Scripts Scripts Scripts Scripts

取得 ScriptReferenceCollection 物件,這個物件包含許多 ScriptReference 物件,其中每個物件都代表一個呈現給用戶端的指令碼檔。Gets a ScriptReferenceCollection object that contains the ScriptReference objects, each of which represents a script file rendered to the client.

Services Services Services Services

取得 ServiceReferenceCollection 物件,這個物件包含為了獲得 Ajax 功能 ASP.NET 在用戶端上公開之每個 Web 服務的 ServiceReference 物件。Gets a ServiceReferenceCollection object that contains a ServiceReference object for each Web service that ASP.NET exposes on the client for Ajax functionality.

Site Site Site Site

當呈現在設計介面上時,取得裝載目前控制項之容器的資訊。Gets information about the container that hosts the current control when rendered on a design surface.

(Inherited from Control)
SkinID SkinID SkinID SkinID

取得或設定要套用至控制項的面板。Gets or sets the skin to apply to the control.

(Inherited from Control)
SupportsPartialRendering SupportsPartialRendering SupportsPartialRendering SupportsPartialRendering

取得值,這個值指出用戶端是否支援部分網頁呈現。Gets a value that indicates whether the client supports partial-page rendering.

TemplateControl TemplateControl TemplateControl TemplateControl

取得或設定包含了此控制項之樣板的參考。Gets or sets a reference to the template that contains this control.

(Inherited from Control)
TemplateSourceDirectory TemplateSourceDirectory TemplateSourceDirectory TemplateSourceDirectory

取得包含目前伺服器控制項的 PageUserControl 的虛擬目錄。Gets the virtual directory of the Page or UserControl that contains the current server control.

(Inherited from Control)
UniqueID UniqueID UniqueID UniqueID

取得伺服器控制項唯一的、符合階層架構的識別項。Gets the unique, hierarchically qualified identifier for the server control.

(Inherited from Control)
ValidateRequestMode ValidateRequestMode ValidateRequestMode ValidateRequestMode

取得或設定值,指出控制項是否對來自瀏覽器的用戶端輸入檢查潛在的危險值。Gets or sets a value that indicates whether the control checks client input from the browser for potentially dangerous values.

(Inherited from Control)
ViewState ViewState ViewState ViewState

取得狀態資訊的字典,允許您在相同網頁的多個要求之間,儲存和還原伺服器控制項的檢視狀態。Gets a dictionary of state information that allows you to save and restore the view state of a server control across multiple requests for the same page.

(Inherited from Control)
ViewStateIgnoresCase ViewStateIgnoresCase ViewStateIgnoresCase ViewStateIgnoresCase

取得值,指出 StateBag 物件是否不區分大小寫。Gets a value that indicates whether the StateBag object is case-insensitive.

(Inherited from Control)
ViewStateMode ViewStateMode ViewStateMode ViewStateMode

取得或設定這個控制項的檢視狀態模式。Gets or sets the view-state mode of this control.

(Inherited from Control)
Visible Visible Visible Visible

覆寫繼承自基底 Visible 類別的 Control 屬性,以防止設定此值。Overrides the Visible property that is inherited from the base Control class to prevent setting this value.

方法

AddedControl(Control, Int32) AddedControl(Control, Int32) AddedControl(Control, Int32) AddedControl(Control, Int32)

在子控制項加入 Control 物件的 Controls 集合後呼叫。Called after a child control is added to the Controls collection of the Control object.

(Inherited from Control)
AddHistoryPoint(NameValueCollection, String) AddHistoryPoint(NameValueCollection, String) AddHistoryPoint(NameValueCollection, String) AddHistoryPoint(NameValueCollection, String)

透過使用指定的狀態資料集合和狀態標題,進行建立記錄點,並將其加入瀏覽器的記錄堆疊。Creates a history point and adds it to the browser's history stack, using the specified state data collection and state title.

AddHistoryPoint(String, String) AddHistoryPoint(String, String) AddHistoryPoint(String, String) AddHistoryPoint(String, String)

透過使用指定的狀態索引鍵和狀態值,進行建立記錄點,並將其加入瀏覽器的記錄堆疊。Creates a history point and adds it to the browser's history stack, using the specified state key and state value.

AddHistoryPoint(String, String, String) AddHistoryPoint(String, String, String) AddHistoryPoint(String, String, String) AddHistoryPoint(String, String, String)

透過使用指定的狀態索引鍵、狀態值和狀態標題,進行建立記錄點,並將它加入至瀏覽器的記錄堆疊。Creates a history point and adds it to the browser's history stack, using the specified state key, state value, and state title.

AddParsedSubObject(Object) AddParsedSubObject(Object) AddParsedSubObject(Object) AddParsedSubObject(Object)

通知伺服器控制項,XML 或 HTML 項目已剖析,並將項目加入伺服器控制項的 ControlCollection 物件中。Notifies the server control that an element, either XML or HTML, was parsed, and adds the element to the server control's ControlCollection object.

(Inherited from Control)
ApplyStyleSheetSkin(Page) ApplyStyleSheetSkin(Page) ApplyStyleSheetSkin(Page) ApplyStyleSheetSkin(Page)

將頁面樣式表中所定義的樣式屬性套用至控制項。Applies the style properties defined in the page style sheet to the control.

(Inherited from Control)
BeginRenderTracing(TextWriter, Object) BeginRenderTracing(TextWriter, Object) BeginRenderTracing(TextWriter, Object) BeginRenderTracing(TextWriter, Object)

開始進行轉譯資料的設計階段追蹤。Begins design-time tracing of rendering data.

(Inherited from Control)
BuildProfileTree(String, Boolean) BuildProfileTree(String, Boolean) BuildProfileTree(String, Boolean) BuildProfileTree(String, Boolean)

收集伺服器控制項的相關資訊,並在頁面啟用追蹤時將此資訊傳遞至 Trace 屬性以顯示之。Gathers information about the server control and delivers it to the Trace property to be displayed when tracing is enabled for the page.

(Inherited from Control)
ClearCachedClientID() ClearCachedClientID() ClearCachedClientID() ClearCachedClientID()

將快取的 ClientID 值設定為 nullSets the cached ClientID value to null.

(Inherited from Control)
ClearChildControlState() ClearChildControlState() ClearChildControlState() ClearChildControlState()

刪除伺服器控制項之子控制項的控制項狀態資訊。Deletes the control-state information for the server control's child controls.

(Inherited from Control)
ClearChildState() ClearChildState() ClearChildState() ClearChildState()

刪除所有伺服器控制項之子控制項的檢視狀態和控制項狀態資訊。Deletes the view-state and control-state information for all the server control's child controls.

(Inherited from Control)
ClearChildViewState() ClearChildViewState() ClearChildViewState() ClearChildViewState()

刪除所有伺服器控制項之子控制項的檢視狀態資訊。Deletes the view-state information for all the server control's child controls.

(Inherited from Control)
ClearEffectiveClientIDMode() ClearEffectiveClientIDMode() ClearEffectiveClientIDMode() ClearEffectiveClientIDMode()

將目前的控制項執行個體和任何子控制項的 ClientIDMode 屬性設定為 InheritSets the ClientIDMode property of the current control instance and of any child controls to Inherit.

(Inherited from Control)
CreateChildControls() CreateChildControls() CreateChildControls() CreateChildControls()

由 ASP.NET 網頁架構呼叫,通知使用組合實作的伺服器控制項來建立所包含的任何子控制項,以準備回傳或呈現。Called by the ASP.NET page framework to notify server controls that use composition-based implementation to create any child controls they contain in preparation for posting back or rendering.

(Inherited from Control)
CreateControlCollection() CreateControlCollection() CreateControlCollection() CreateControlCollection()

建立新的 ControlCollection 物件來保存伺服器控制項的子控制項 (常值和伺服器)。Creates a new ControlCollection object to hold the child controls (both literal and server) of the server control.

(Inherited from Control)
DataBind() DataBind() DataBind() DataBind()

將資料來源繫結至叫用的伺服器控制項和它的全部子控制項。Binds a data source to the invoked server control and all its child controls.

(Inherited from Control)
DataBind(Boolean) DataBind(Boolean) DataBind(Boolean) DataBind(Boolean)

使用會引發 DataBinding 事件的選項,繫結資料來源至叫用的伺服器控制項及其所有子控制項。Binds a data source to the invoked server control and all its child controls with an option to raise the DataBinding event.

(Inherited from Control)
DataBindChildren() DataBindChildren() DataBindChildren() DataBindChildren()

繫結資料來源至伺服器控制項的子控制項。Binds a data source to the server control's child controls.

(Inherited from Control)
Dispose() Dispose() Dispose() Dispose()

啟用伺服器控制項,在它從記憶體釋放之前執行最後清除。Enables a server control to perform final clean up before it is released from memory.

(Inherited from Control)
EndRenderTracing(TextWriter, Object) EndRenderTracing(TextWriter, Object) EndRenderTracing(TextWriter, Object) EndRenderTracing(TextWriter, Object)

結束轉譯資料的設計階段追蹤。Ends design-time tracing of rendering data.

(Inherited from Control)
EnsureChildControls() EnsureChildControls() EnsureChildControls() EnsureChildControls()

判斷伺服器控制項是否包含子控制項。Determines whether the server control contains child controls. 如果不包含,則建立子控制項。If it does not, it creates child controls.

(Inherited from Control)
EnsureID() EnsureID() EnsureID() EnsureID()

為尚未指定識別項的控制項,建立識別項。Creates an identifier for controls that do not have an identifier assigned.

(Inherited from Control)
Equals(Object) Equals(Object) Equals(Object) Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(Inherited from Object)
FindControl(String) FindControl(String) FindControl(String) FindControl(String)

在目前命名容器搜尋具有指定 id 參數的伺服器控制項。Searches the current naming container for a server control with the specified id parameter.

(Inherited from Control)
FindControl(String, Int32) FindControl(String, Int32) FindControl(String, Int32) FindControl(String, Int32)

使用指定的 id 和有助於搜尋之 pathOffset 參數中所指定的整數,在目前的命名容器中搜尋伺服器控制項。Searches the current naming container for a server control with the specified id and an integer, specified in the pathOffset parameter, which aids in the search. 您不應該覆寫這個版本的 FindControl 方法。You should not override this version of the FindControl method.

(Inherited from Control)
Focus() Focus() Focus() Focus()

設定控制項的輸入焦點。Sets input focus to a control.

(Inherited from Control)
GetCurrent(Page) GetCurrent(Page) GetCurrent(Page) GetCurrent(Page)

取得特定 ScriptManager 物件的 Page 執行個體。Gets the ScriptManager instance for a given Page object.

GetDesignModeState() GetDesignModeState() GetDesignModeState() GetDesignModeState()

取得控制項的設計階段資料。Gets design-time data for a control.

(Inherited from Control)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

做為預設雜湊函式。Serves as the default hash function.

(Inherited from Object)
GetRegisteredArrayDeclarations() GetRegisteredArrayDeclarations() GetRegisteredArrayDeclarations() GetRegisteredArrayDeclarations()

擷取 ECMAScript (JavaScript) 陣列宣告的唯讀集合,該陣列宣告先前是以 Page 物件註冊。Retrieves a read-only collection of ECMAScript (JavaScript) array declarations that were previously registered with the Page object.

GetRegisteredClientScriptBlocks() GetRegisteredClientScriptBlocks() GetRegisteredClientScriptBlocks() GetRegisteredClientScriptBlocks()

擷取用戶端指令碼區塊的唯讀集合,區塊先前是以 ScriptManager 控制項註冊。Retrieves a read-only collection of client script blocks that were previously registered with the ScriptManager control.

GetRegisteredDisposeScripts() GetRegisteredDisposeScripts() GetRegisteredDisposeScripts() GetRegisteredDisposeScripts()

擷取 dispose 指令碼的唯讀集合,指令碼先前是以 Page 物件註冊。Retrieves a read-only collection of dispose scripts that were previously registered with the Page object.

GetRegisteredExpandoAttributes() GetRegisteredExpandoAttributes() GetRegisteredExpandoAttributes() GetRegisteredExpandoAttributes()

擷取自訂 (expando) 屬性的唯讀集合,屬性先前是以 Page 物件註冊。Retrieves a read-only collection of custom (expando) attributes that were previously registered with the Page object.

GetRegisteredHiddenFields() GetRegisteredHiddenFields() GetRegisteredHiddenFields() GetRegisteredHiddenFields()

擷取隱藏欄位的唯讀集合,欄位先前是以 Page 物件註冊。Retrieves a read-only collection of hidden fields that were previously registered with the Page object.

GetRegisteredOnSubmitStatements() GetRegisteredOnSubmitStatements() GetRegisteredOnSubmitStatements() GetRegisteredOnSubmitStatements()

擷取 onsubmit 陳述式的唯讀集合,陳述式先前是以 Page 物件註冊。Retrieves a read-only collection of onsubmit statements that were previously registered with the Page object.

GetRegisteredStartupScripts() GetRegisteredStartupScripts() GetRegisteredStartupScripts() GetRegisteredStartupScripts()

擷取啟始指令碼的唯讀集合,指令碼先前是以 Page 物件註冊。Retrieves a read-only collection of startup scripts that were previously registered with the Page object.

GetRouteUrl(Object) GetRouteUrl(Object) GetRouteUrl(Object) GetRouteUrl(Object)

取得會對應於一組路由參數的 URL。Gets the URL that corresponds to a set of route parameters.

(Inherited from Control)
GetRouteUrl(RouteValueDictionary) GetRouteUrl(RouteValueDictionary) GetRouteUrl(RouteValueDictionary) GetRouteUrl(RouteValueDictionary)

取得會對應於一組路由參數的 URL。Gets the URL that corresponds to a set of route parameters.

(Inherited from Control)
GetRouteUrl(String, Object) GetRouteUrl(String, Object) GetRouteUrl(String, Object) GetRouteUrl(String, Object)

取得 URL,此 URL 對應於一組路由參數及一個路由名稱。Gets the URL that corresponds to a set of route parameters and a route name.

(Inherited from Control)
GetRouteUrl(String, RouteValueDictionary) GetRouteUrl(String, RouteValueDictionary) GetRouteUrl(String, RouteValueDictionary) GetRouteUrl(String, RouteValueDictionary)

取得 URL,此 URL 對應於一組路由參數及一個路由名稱。Gets the URL that corresponds to a set of route parameters and a route name.

(Inherited from Control)
GetStateString() GetStateString() GetStateString() GetStateString()

擷取字串,這個字串內含表示網頁狀態的索引鍵/值組。Retrieves a string that contains key/value pairs that represent the state of the Web page.

GetType() GetType() GetType() GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(Inherited from Object)
GetUniqueIDRelativeTo(Control) GetUniqueIDRelativeTo(Control) GetUniqueIDRelativeTo(Control) GetUniqueIDRelativeTo(Control)

傳回指定之控制項 UniqueID 屬性的前置部分。Returns the prefixed portion of the UniqueID property of the specified control.

(Inherited from Control)
HasControls() HasControls() HasControls() HasControls()

判斷伺服器控制項是否包含任何子控制項。Determines if the server control contains any child controls.

(Inherited from Control)
HasEvents() HasEvents() HasEvents() HasEvents()

傳回值,指出控制項或任何子控制項的事件是否已註冊。Returns a value indicating whether events are registered for the control or any child controls.

(Inherited from Control)
IsLiteralContent() IsLiteralContent() IsLiteralContent() IsLiteralContent()

判斷伺服器控制項是否只儲存常值內容。Determines if the server control holds only literal content.

(Inherited from Control)
LoadControlState(Object) LoadControlState(Object) LoadControlState(Object) LoadControlState(Object)

SaveControlState() 方法所儲存的上一頁要求中,還原控制項狀態資訊。Restores control-state information from a previous page request that was saved by the SaveControlState() method.

(Inherited from Control)
LoadPostData(String, NameValueCollection) LoadPostData(String, NameValueCollection) LoadPostData(String, NameValueCollection) LoadPostData(String, NameValueCollection)

讀取從瀏覽器張貼至伺服器的表單資料,並決定非同步回傳的來源。Reads form data that is posted from the browser to the server, and determines the source of the asynchronous postback.

LoadViewState(Object) LoadViewState(Object) LoadViewState(Object) LoadViewState(Object)

將檢視狀態資訊從 SaveViewState() 方法所儲存的上一個網頁要求還原。Restores view-state information from a previous page request that was saved by the SaveViewState() method.

(Inherited from Control)
MapPathSecure(String) MapPathSecure(String) MapPathSecure(String) MapPathSecure(String)

擷取虛擬絕對路徑或相對路徑所對應至的實體路徑。Retrieves the physical path that a virtual path, either absolute or relative, maps to.

(Inherited from Control)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

建立目前 Object 的淺層複本 (Shallow Copy)。Creates a shallow copy of the current Object.

(Inherited from Object)
OnAsyncPostBackError(AsyncPostBackErrorEventArgs) OnAsyncPostBackError(AsyncPostBackErrorEventArgs) OnAsyncPostBackError(AsyncPostBackErrorEventArgs) OnAsyncPostBackError(AsyncPostBackErrorEventArgs)

引發 AsyncPostBackError 事件。Raises the AsyncPostBackError event.

OnBubbleEvent(Object, EventArgs) OnBubbleEvent(Object, EventArgs) OnBubbleEvent(Object, EventArgs) OnBubbleEvent(Object, EventArgs)

決定伺服器控制項的事件是否要在頁面的 UI 伺服器控制項階層架構中向上傳遞。Determines whether the event for the server control is passed up the page's UI server control hierarchy.

(Inherited from Control)
OnDataBinding(EventArgs) OnDataBinding(EventArgs) OnDataBinding(EventArgs) OnDataBinding(EventArgs)

引發 DataBinding 事件。Raises the DataBinding event.

(Inherited from Control)
OnInit(EventArgs) OnInit(EventArgs) OnInit(EventArgs) OnInit(EventArgs)

引發 Init 事件,並確保網頁上只存在一個 ScriptManager 控制項。Raises the Init event and makes sure that only one ScriptManager control exists on the page.

OnLoad(EventArgs) OnLoad(EventArgs) OnLoad(EventArgs) OnLoad(EventArgs)

引發 Load 事件。Raises the Load event.

(Inherited from Control)
OnPreRender(EventArgs) OnPreRender(EventArgs) OnPreRender(EventArgs) OnPreRender(EventArgs)

引發 PreRender 事件,並註冊指令碼檔和服務,以進行部分網頁更新。Raises the PreRender event, and registers script files and services for partial-page updates.

OnResolveCompositeScriptReference(CompositeScriptReferenceEventArgs) OnResolveCompositeScriptReference(CompositeScriptReferenceEventArgs) OnResolveCompositeScriptReference(CompositeScriptReferenceEventArgs) OnResolveCompositeScriptReference(CompositeScriptReferenceEventArgs)

引發 ResolveCompositeScriptReference 事件。Raises the ResolveCompositeScriptReference event.

OnResolveScriptReference(ScriptReferenceEventArgs) OnResolveScriptReference(ScriptReferenceEventArgs) OnResolveScriptReference(ScriptReferenceEventArgs) OnResolveScriptReference(ScriptReferenceEventArgs)

針對 ResolveScriptReference 控制項管理的每個指令碼參考,引發 ScriptManager 事件。Raises the ResolveScriptReference event for each script reference that is managed by the ScriptManager control.

OnUnload(EventArgs) OnUnload(EventArgs) OnUnload(EventArgs) OnUnload(EventArgs)

引發 Unload 事件。Raises the Unload event.

(Inherited from Control)
OpenFile(String) OpenFile(String) OpenFile(String) OpenFile(String)

取得用來讀取檔案的 StreamGets a Stream used to read a file.

(Inherited from Control)
RaiseBubbleEvent(Object, EventArgs) RaiseBubbleEvent(Object, EventArgs) RaiseBubbleEvent(Object, EventArgs) RaiseBubbleEvent(Object, EventArgs)

指派事件的任何來源和它的資訊至控制項的父控制項。Assigns any sources of the event and its information to the control's parent.

(Inherited from Control)
RaisePostBackEvent(String) RaisePostBackEvent(String) RaisePostBackEvent(String) RaisePostBackEvent(String)

處理 ScriptManager 控制項所引發的回傳事件,並載入網頁的記錄狀態。Processes a postback event raised by the ScriptManager control and loads the history state of the Web page.

RaisePostDataChangedEvent() RaisePostDataChangedEvent() RaisePostDataChangedEvent() RaisePostDataChangedEvent()

回傳至伺服器時,便會引發 ScriptManager 控制項的事件。Raises events for the ScriptManager control when it posts back to the server.

RegisterArrayDeclaration(Control, String, String) RegisterArrayDeclaration(Control, String, String) RegisterArrayDeclaration(Control, String, String) RegisterArrayDeclaration(Control, String, String)

使用 ScriptManager 控制項註冊 ECMAScript (JavaScript) 陣列宣告,以配合 UpdatePanel 控制項內部的控制項一起使用,並將陣列加入至網頁中。Registers an ECMAScript (JavaScript) array declaration with the ScriptManager control for use with a control that is inside an UpdatePanel control, and adds the array to the page.

RegisterArrayDeclaration(Page, String, String) RegisterArrayDeclaration(Page, String, String) RegisterArrayDeclaration(Page, String, String) RegisterArrayDeclaration(Page, String, String)

使用 ScriptManager 控制項註冊 ECMAScript (JavaScript) 陣列宣告,以配合 UpdatePanel 控制項內部的控制項一起使用,並將陣列加入至網頁中。Registers an ECMAScript (JavaScript) array declaration with the ScriptManager control for use with a control that is inside an UpdatePanel control, and adds the array to the page.

RegisterAsyncPostBackControl(Control) RegisterAsyncPostBackControl(Control) RegisterAsyncPostBackControl(Control) RegisterAsyncPostBackControl(Control)

將控制項註冊為非同步回傳的觸發程序。Registers a control as a trigger for asynchronous postbacks.

RegisterClientScriptBlock(Control, Type, String, String, Boolean) RegisterClientScriptBlock(Control, Type, String, String, Boolean) RegisterClientScriptBlock(Control, Type, String, String, Boolean) RegisterClientScriptBlock(Control, Type, String, String, Boolean)

使用 ScriptManager 控制項註冊用戶端指令碼區塊,以配合 UpdatePanel 控制項內部的控制項一起使用,並將指令碼區塊加入至網頁中。Registers a client script block with the ScriptManager control for use with a control that is inside an UpdatePanel control, and then adds the script block to the page.

RegisterClientScriptBlock(Page, Type, String, String, Boolean) RegisterClientScriptBlock(Page, Type, String, String, Boolean) RegisterClientScriptBlock(Page, Type, String, String, Boolean) RegisterClientScriptBlock(Page, Type, String, String, Boolean)

使用 ScriptManager 控制項註冊用戶端指令碼區塊,以配合 UpdatePanel 控制項內部的控制項一起使用,並將指令碼區塊加入至網頁中。Registers a client script block with the ScriptManager control for use with a control that is inside an UpdatePanel control, and then adds the script block to the page.

RegisterClientScriptInclude(Control, Type, String, String) RegisterClientScriptInclude(Control, Type, String, String) RegisterClientScriptInclude(Control, Type, String, String) RegisterClientScriptInclude(Control, Type, String, String)

使用 ScriptManager 控制項註冊用戶端指令碼檔案,以配合 UpdatePanel 控制項內部的控制項一起使用,並將指令碼檔案參考加入至網頁中。Registers a client script file with the ScriptManager control for use with a control that is inside an UpdatePanel control, and then adds a script file reference to the page.

RegisterClientScriptInclude(Page, Type, String, String) RegisterClientScriptInclude(Page, Type, String, String) RegisterClientScriptInclude(Page, Type, String, String) RegisterClientScriptInclude(Page, Type, String, String)

每次發生非同步回傳時,使用 ScriptManager 控制項註冊用戶端指令碼,並將指令碼檔案參考加入至網頁中。Registers client script with the ScriptManager control every time that an asynchronous postback occurs, and then adds a script file reference to the page.

RegisterClientScriptResource(Control, Type, String) RegisterClientScriptResource(Control, Type, String) RegisterClientScriptResource(Control, Type, String) RegisterClientScriptResource(Control, Type, String)

使用 ScriptManager 控制項註冊內嵌在組件中的用戶端指令碼,以配合參與部分網頁呈現的控制項一起使用。Registers the client script that is embedded in an assembly with the ScriptManager control for use with a control that is participating in partial-page rendering.

RegisterClientScriptResource(Page, Type, String) RegisterClientScriptResource(Page, Type, String) RegisterClientScriptResource(Page, Type, String) RegisterClientScriptResource(Page, Type, String)

每次發生回傳時,使用 ScriptManager 控制項註冊內嵌在組件中的用戶端指令碼檔案。Registers a client script file that is embedded in an assembly with the ScriptManager control every time that a postback occurs.

RegisterDataItem(Control, String) RegisterDataItem(Control, String) RegisterDataItem(Control, String) RegisterDataItem(Control, String)

在部分網頁呈現期間,將自訂資料傳送至控制項。Sends custom data to a control during partial-page rendering.

RegisterDataItem(Control, String, Boolean) RegisterDataItem(Control, String, Boolean) RegisterDataItem(Control, String, Boolean) RegisterDataItem(Control, String, Boolean)

在部分網頁呈現期間將自訂資料傳送至控制項,並指出資料是否是「JavaScript 物件標記法」(JSON) 格式。Sends custom data to a control during partial-page rendering, and indicates whether the data is in JavaScript Object Notation (JSON) format.

RegisterDispose(Control, String) RegisterDispose(Control, String) RegisterDispose(Control, String) RegisterDispose(Control, String)

針對 UpdatePanel 控制項內部的一個控制項,註冊 dispose 指令碼。Registers a dispose script for a control that is inside an UpdatePanel control. 更新或刪除 UpdatePanel 控制項時,便會執行該指令碼。The script is executed when the UpdatePanel control is updated or deleted.

RegisterExpandoAttribute(Control, String, String, String, Boolean) RegisterExpandoAttribute(Control, String, String, String, Boolean) RegisterExpandoAttribute(Control, String, String, String, Boolean) RegisterExpandoAttribute(Control, String, String, String, Boolean)

使用 ScriptManager 控制項,將名稱/值組註冊為指定之控制項的自訂 (expando) 屬性。Registers a name/value pair with the ScriptManager control as a custom (expando) attribute of a specified control.

RegisterExtenderControl<TExtenderControl>(TExtenderControl, Control) RegisterExtenderControl<TExtenderControl>(TExtenderControl, Control) RegisterExtenderControl<TExtenderControl>(TExtenderControl, Control) RegisterExtenderControl<TExtenderControl>(TExtenderControl, Control)

使用目前 ScriptManager 執行個體註冊擴充項控制項。Registers an extender control with the current ScriptManager instance.

RegisterHiddenField(Control, String, String) RegisterHiddenField(Control, String, String) RegisterHiddenField(Control, String, String) RegisterHiddenField(Control, String, String)

使用 ScriptManager 控制項,為 UpdatePanel 控制項內部的某個控制項註冊隱藏欄位。Registers a hidden field with the ScriptManager control for a control that is inside an UpdatePanel control.

RegisterHiddenField(Page, String, String) RegisterHiddenField(Page, String, String) RegisterHiddenField(Page, String, String) RegisterHiddenField(Page, String, String)

在每次非同步回傳期間,使用 ScriptManager 控制項註冊隱藏欄位。Registers a hidden field with the ScriptManager control during every asynchronous postback.

RegisterNamedClientScriptResource(Control, String) RegisterNamedClientScriptResource(Control, String) RegisterNamedClientScriptResource(Control, String) RegisterNamedClientScriptResource(Control, String)

使用 ScriptManager 控制項註冊內嵌在組件中的用戶端指令碼 (根據資源名稱),以配合參與部分網頁呈現的控制項一起使用。Registers client script by resource name that is embedded in an assembly with the ScriptManager control for use with a control that is participating in partial-page rendering.

RegisterNamedClientScriptResource(Page, String) RegisterNamedClientScriptResource(Page, String) RegisterNamedClientScriptResource(Page, String) RegisterNamedClientScriptResource(Page, String)

使用 ScriptManager 控制項註冊內嵌在組件中的用戶端指令碼 (根據資源名稱),以配合參與部分網頁呈現的控制項一起使用。Registers client script by resource name that is embedded in an assembly with the ScriptManager control for use with a control that is participating in partial-page rendering.

RegisterOnSubmitStatement(Control, Type, String, String) RegisterOnSubmitStatement(Control, Type, String, String) RegisterOnSubmitStatement(Control, Type, String, String) RegisterOnSubmitStatement(Control, Type, String, String)

使用 ScriptManager 控制項,為配合在送出表單時執行之 UpdatePanel 控制項一起使用的控制項,註冊 ECMAScript (JavaScript) 程式碼。Registers ECMAScript (JavaScript) code with the ScriptManager control for a control that is used with an UpdatePanel control that is executed when the form is submitted.

RegisterOnSubmitStatement(Page, Type, String, String) RegisterOnSubmitStatement(Page, Type, String, String) RegisterOnSubmitStatement(Page, Type, String, String) RegisterOnSubmitStatement(Page, Type, String, String)

使用 ScriptManager 控制項,為配合在送出表單時執行之 UpdatePanel 控制項一起使用的控制項,註冊 ECMAScript (JavaScript) 程式碼。Registers ECMAScript (JavaScript) code with the ScriptManager control for a control that is used with an UpdatePanel control that is executed when the form is submitted.

RegisterPostBackControl(Control) RegisterPostBackControl(Control) RegisterPostBackControl(Control) RegisterPostBackControl(Control)

將控制項註冊為回傳的觸發程序。Registers a control as a trigger for a postback. 此方法可用來設定另外執行非同步回傳之 UpdatePanel 控制項內部的回傳控制項。This method is used to configure postback controls inside an UpdatePanel control that would otherwise perform asynchronous postbacks.

RegisterScriptControl<TScriptControl>(TScriptControl) RegisterScriptControl<TScriptControl>(TScriptControl) RegisterScriptControl<TScriptControl>(TScriptControl) RegisterScriptControl<TScriptControl>(TScriptControl)

使用目前 ScriptManager 執行個體註冊指令碼控制項。Registers a script control with the current ScriptManager instance.

RegisterScriptDescriptors(IExtenderControl) RegisterScriptDescriptors(IExtenderControl) RegisterScriptDescriptors(IExtenderControl) RegisterScriptDescriptors(IExtenderControl)

回撥 ExtenderControl 類別,以傳回必須加以呈現的執行個體指令碼,以支援代表用戶端控制項、元件或行為用戶端物件。Calls back to an ExtenderControl class to return instance scripts that must be rendered to support the client object that represents a client control, component, or behavior.

RegisterScriptDescriptors(IScriptControl) RegisterScriptDescriptors(IScriptControl) RegisterScriptDescriptors(IScriptControl) RegisterScriptDescriptors(IScriptControl)

呼叫 ScriptControl 類別,以傳回必須加以呈現,以支援代表用戶端控制項、元件或行為之用戶端物件的執行個體指令碼。Calls a ScriptControl class to return instance scripts that must be rendered to support the client object that represents a client control, component, or behavior.

RegisterStartupScript(Control, Type, String, String, Boolean) RegisterStartupScript(Control, Type, String, String, Boolean) RegisterStartupScript(Control, Type, String, String, Boolean) RegisterStartupScript(Control, Type, String, String, Boolean)

使用 UpdatePanel 控制項,為 ScriptManager 內部的某個控制項註冊啟動指令碼區塊,並將指令碼區塊加入至網頁中。Registers a startup script block for a control that is inside an UpdatePanel by using the ScriptManager control, and adds the script block to the page.

RegisterStartupScript(Page, Type, String, String, Boolean) RegisterStartupScript(Page, Type, String, String, Boolean) RegisterStartupScript(Page, Type, String, String, Boolean) RegisterStartupScript(Page, Type, String, String, Boolean)

使用 ScriptManager 控制項註冊每次非同步回傳的啟動指令碼區塊,並將指令碼區塊加入至網頁中。Registers a startup script block for every asynchronous postback with the ScriptManager control and adds the script block to the page.

RemovedControl(Control) RemovedControl(Control) RemovedControl(Control) RemovedControl(Control)

Control 物件的 Controls 集合中移除子控制項之後呼叫。Called after a child control is removed from the Controls collection of the Control object.

(Inherited from Control)
Render(HtmlTextWriter) Render(HtmlTextWriter) Render(HtmlTextWriter) Render(HtmlTextWriter)

使用指定的 ScriptManager 物件,將 HtmlTextWriter 控制項內容呈現至瀏覽器。Renders the ScriptManager control's content to the browser by using the specified HtmlTextWriter object.

RenderChildren(HtmlTextWriter) RenderChildren(HtmlTextWriter) RenderChildren(HtmlTextWriter) RenderChildren(HtmlTextWriter)

輸出伺服器控制項之子控制項的內容至提供的 HtmlTextWriter 物件,這個物件會寫入用戶端上所要呈現的內容。Outputs the content of a server control's children to a provided HtmlTextWriter object, which writes the content to be rendered on the client.

(Inherited from Control)
RenderControl(HtmlTextWriter) RenderControl(HtmlTextWriter) RenderControl(HtmlTextWriter) RenderControl(HtmlTextWriter)

將伺服器控制項內容輸出至提供的 HtmlTextWriter 物件,並在啟用追蹤時儲存控制項的追蹤資訊。Outputs server control content to a provided HtmlTextWriter object and stores tracing information about the control if tracing is enabled.

(Inherited from Control)
RenderControl(HtmlTextWriter, ControlAdapter) RenderControl(HtmlTextWriter, ControlAdapter) RenderControl(HtmlTextWriter, ControlAdapter) RenderControl(HtmlTextWriter, ControlAdapter)

使用提供的 HtmlTextWriter 物件,輸出伺服器控制項內容至提供的 ControlAdapter 物件。Outputs server control content to a provided HtmlTextWriter object using a provided ControlAdapter object.

(Inherited from Control)
ResolveAdapter() ResolveAdapter() ResolveAdapter() ResolveAdapter()

取得負責呈現指定之控制項的控制項配置器。Gets the control adapter responsible for rendering the specified control.

(Inherited from Control)
ResolveClientUrl(String) ResolveClientUrl(String) ResolveClientUrl(String) ResolveClientUrl(String)

取得瀏覽器可使用的 URL。Gets a URL that can be used by the browser.

(Inherited from Control)
ResolveUrl(String) ResolveUrl(String) ResolveUrl(String) ResolveUrl(String)

將 URL 轉換為要求用戶端可使用的 URL。Converts a URL into one that is usable on the requesting client.

(Inherited from Control)
SaveControlState() SaveControlState() SaveControlState() SaveControlState()

儲存頁面回傳至伺服器以來,所發生的任何伺服器控制項狀態變更。Saves any server control state changes that have occurred since the time the page was posted back to the server.

(Inherited from Control)
SaveViewState() SaveViewState() SaveViewState() SaveViewState()

儲存自頁面回傳至伺服器以來所發生的任何伺服器控制項檢視狀態變更。Saves any server control view-state changes that have occurred since the time the page was posted back to the server.

(Inherited from Control)
SetDesignModeState(IDictionary) SetDesignModeState(IDictionary) SetDesignModeState(IDictionary) SetDesignModeState(IDictionary)

設定控制項的設計階段資料。Sets design-time data for a control.

(Inherited from Control)
SetFocus(Control) SetFocus(Control) SetFocus(Control) SetFocus(Control)

將瀏覽器焦點設為指定的控制項。Sets the browser focus to the specified control.

SetFocus(String) SetFocus(String) SetFocus(String) SetFocus(String)

將瀏覽器焦點設定為由 ID 指定的控制項。Sets the browser focus to the control specified by ID.

SetRenderMethodDelegate(RenderMethod) SetRenderMethodDelegate(RenderMethod) SetRenderMethodDelegate(RenderMethod) SetRenderMethodDelegate(RenderMethod)

指定事件處理常式委派,以呈現伺服器控制項及其內容至其父控制項。Assigns an event handler delegate to render the server control and its content into its parent control.

(Inherited from Control)
SetTraceData(Object, Object) SetTraceData(Object, Object) SetTraceData(Object, Object) SetTraceData(Object, Object)

使用追蹤資料機碼和追蹤資料值,設定設計階段期間追蹤呈現資料的追蹤資料。Sets trace data for design-time tracing of rendering data, using the trace data key and the trace data value.

(Inherited from Control)
SetTraceData(Object, Object, Object) SetTraceData(Object, Object, Object) SetTraceData(Object, Object, Object) SetTraceData(Object, Object, Object)

使用追蹤的物體、追蹤資料機碼和追蹤資料值,設定設計階段期間追蹤呈現資料的追蹤資料。Sets trace data for design-time tracing of rendering data, using the traced object, the trace data key, and the trace data value.

(Inherited from Control)
ToString() ToString() ToString() ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(Inherited from Object)
TrackViewState() TrackViewState() TrackViewState() TrackViewState()

導致對伺服器控制項的檢視狀態變更的追蹤 (Tracking),以便它們能夠儲存於伺服器控制項的 StateBag 物件。Causes tracking of view-state changes to the server control so they can be stored in the server control's StateBag object. 這個物件可透過 ViewState 屬性存取。This object is accessible through the ViewState property.

(Inherited from Control)

事件

AsyncPostBackError AsyncPostBackError AsyncPostBackError AsyncPostBackError

發生於非同步回傳期間發生頁面錯誤時。Occurs when there is a page error during an asynchronous postback.

DataBinding DataBinding DataBinding DataBinding

發生於伺服器控制項繫結至資料來源時。Occurs when the server control binds to a data source.

(Inherited from Control)
Disposed Disposed Disposed Disposed

發生於伺服器控制項從記憶體釋放時,這是在要求 ASP.NET 網頁時,伺服器控制項生命週期的最後階段。Occurs when a server control is released from memory, which is the last stage of the server control lifecycle when an ASP.NET page is requested.

(Inherited from Control)
Init Init Init Init

發生於初始化伺服器控制項時,是其生命週期中的第一個步驟。Occurs when the server control is initialized, which is the first step in its lifecycle.

(Inherited from Control)
Load Load Load Load

發生於載入伺服器控制項至 Page 物件時。Occurs when the server control is loaded into the Page object.

(Inherited from Control)
Navigate Navigate Navigate Navigate

當使用者按一下瀏覽器的 [上一頁] 或 [下一頁] 按鈕時發生。Occurs when the user clicks the browser's Back or Forward button.

PreRender PreRender PreRender PreRender

Control 物件載入之後但在呈現之前發生。Occurs after the Control object is loaded but prior to rendering.

(Inherited from Control)
ResolveCompositeScriptReference ResolveCompositeScriptReference ResolveCompositeScriptReference ResolveCompositeScriptReference

發生於複合指令碼已向 ScriptManager 控制項註冊時。Occurs when a composite script is registered with the ScriptManager control.

ResolveScriptReference ResolveScriptReference ResolveScriptReference ResolveScriptReference

發生於使用 Scripts 控制項註冊 ScriptManager 集合的成員時。Occurs when a member of the Scripts collection is registered with the ScriptManager control.

Unload Unload Unload Unload

發生於伺服器控制項從記憶體卸載時。Occurs when the server control is unloaded from memory.

(Inherited from Control)

明確介面實作

IControlDesignerAccessor.GetDesignModeState() IControlDesignerAccessor.GetDesignModeState() IControlDesignerAccessor.GetDesignModeState() IControlDesignerAccessor.GetDesignModeState()

如需這個成員的說明,請參閱 GetDesignModeState()For a description of this member, see GetDesignModeState().

(Inherited from Control)
IControlDesignerAccessor.SetDesignModeState(IDictionary) IControlDesignerAccessor.SetDesignModeState(IDictionary) IControlDesignerAccessor.SetDesignModeState(IDictionary) IControlDesignerAccessor.SetDesignModeState(IDictionary)

如需這個成員的說明,請參閱 SetDesignModeState(IDictionary)For a description of this member, see SetDesignModeState(IDictionary).

(Inherited from Control)
IControlDesignerAccessor.SetOwnerControl(Control) IControlDesignerAccessor.SetOwnerControl(Control) IControlDesignerAccessor.SetOwnerControl(Control) IControlDesignerAccessor.SetOwnerControl(Control)

如需這個成員的說明,請參閱 SetOwnerControl(Control)For a description of this member, see SetOwnerControl(Control).

(Inherited from Control)
IParserAccessor.AddParsedSubObject(Object) IParserAccessor.AddParsedSubObject(Object) IParserAccessor.AddParsedSubObject(Object) IParserAccessor.AddParsedSubObject(Object)

如需這個成員的說明,請參閱 AddParsedSubObject(Object)For a description of this member, see AddParsedSubObject(Object).

(Inherited from Control)
IPostBackDataHandler.LoadPostData(String, NameValueCollection) IPostBackDataHandler.LoadPostData(String, NameValueCollection) IPostBackDataHandler.LoadPostData(String, NameValueCollection) IPostBackDataHandler.LoadPostData(String, NameValueCollection)

如需這個成員的說明,請參閱 LoadPostData(String, NameValueCollection)For a description of this member, see LoadPostData(String, NameValueCollection).

IPostBackDataHandler.RaisePostDataChangedEvent() IPostBackDataHandler.RaisePostDataChangedEvent() IPostBackDataHandler.RaisePostDataChangedEvent() IPostBackDataHandler.RaisePostDataChangedEvent()

如需這個成員的說明,請參閱 RaisePostDataChangedEvent()For a description of this member, see RaisePostDataChangedEvent().

IPostBackEventHandler.RaisePostBackEvent(String) IPostBackEventHandler.RaisePostBackEvent(String) IPostBackEventHandler.RaisePostBackEvent(String) IPostBackEventHandler.RaisePostBackEvent(String)

啟用 ScriptManager 控制項,以處理回傳事件以及載入網頁的記錄狀態。Enables the ScriptManager control to process a postback event and load the history state of the Web page.

IScriptManager.IsSecureConnection IScriptManager.IsSecureConnection IScriptManager.IsSecureConnection IScriptManager.IsSecureConnection
IScriptManager.RegisterArrayDeclaration(Control, String, String) IScriptManager.RegisterArrayDeclaration(Control, String, String) IScriptManager.RegisterArrayDeclaration(Control, String, String) IScriptManager.RegisterArrayDeclaration(Control, String, String)
IScriptManager.RegisterClientScriptBlock(Control, Type, String, String, Boolean) IScriptManager.RegisterClientScriptBlock(Control, Type, String, String, Boolean) IScriptManager.RegisterClientScriptBlock(Control, Type, String, String, Boolean) IScriptManager.RegisterClientScriptBlock(Control, Type, String, String, Boolean)
IScriptManager.RegisterClientScriptInclude(Control, Type, String, String) IScriptManager.RegisterClientScriptInclude(Control, Type, String, String) IScriptManager.RegisterClientScriptInclude(Control, Type, String, String) IScriptManager.RegisterClientScriptInclude(Control, Type, String, String)
IScriptManager.RegisterClientScriptResource(Control, Type, String) IScriptManager.RegisterClientScriptResource(Control, Type, String) IScriptManager.RegisterClientScriptResource(Control, Type, String) IScriptManager.RegisterClientScriptResource(Control, Type, String)
IScriptManager.RegisterDispose(Control, String) IScriptManager.RegisterDispose(Control, String) IScriptManager.RegisterDispose(Control, String) IScriptManager.RegisterDispose(Control, String)
IScriptManager.RegisterExpandoAttribute(Control, String, String, String, Boolean) IScriptManager.RegisterExpandoAttribute(Control, String, String, String, Boolean) IScriptManager.RegisterExpandoAttribute(Control, String, String, String, Boolean) IScriptManager.RegisterExpandoAttribute(Control, String, String, String, Boolean)
IScriptManager.RegisterHiddenField(Control, String, String) IScriptManager.RegisterHiddenField(Control, String, String) IScriptManager.RegisterHiddenField(Control, String, String) IScriptManager.RegisterHiddenField(Control, String, String)
IScriptManager.RegisterOnSubmitStatement(Control, Type, String, String) IScriptManager.RegisterOnSubmitStatement(Control, Type, String, String) IScriptManager.RegisterOnSubmitStatement(Control, Type, String, String) IScriptManager.RegisterOnSubmitStatement(Control, Type, String, String)
IScriptManager.RegisterPostBackControl(Control) IScriptManager.RegisterPostBackControl(Control) IScriptManager.RegisterPostBackControl(Control) IScriptManager.RegisterPostBackControl(Control)
IScriptManager.RegisterStartupScript(Control, Type, String, String, Boolean) IScriptManager.RegisterStartupScript(Control, Type, String, String, Boolean) IScriptManager.RegisterStartupScript(Control, Type, String, String, Boolean) IScriptManager.RegisterStartupScript(Control, Type, String, String, Boolean)
IScriptManager.SetFocusInternal(String) IScriptManager.SetFocusInternal(String) IScriptManager.SetFocusInternal(String) IScriptManager.SetFocusInternal(String)

擴充方法

FindDataSourceControl(Control) FindDataSourceControl(Control) FindDataSourceControl(Control) FindDataSourceControl(Control)

傳回與指定之控制項的資料控制項相關聯的資料來源。Returns the data source that is associated with the data control for the specified control.

FindFieldTemplate(Control, String) FindFieldTemplate(Control, String) FindFieldTemplate(Control, String) FindFieldTemplate(Control, String)

傳回在指定之控制項的命名容器中所指定資料行的欄位樣板。Returns the field template for the specified column in the specified control's naming container.

FindMetaTable(Control) FindMetaTable(Control) FindMetaTable(Control) FindMetaTable(Control)

傳回包含資料控制項的中繼資料表物件。Returns the metatable object for the containing data control.

適用於

另請參閱