Documentation for: ASP.NET Ajax Version 1.0

This documentation is for a previous version. For the current released version, see the ASP.NET Ajax documentation on MSDN.

 

 

 

 

 

 

 

Skip Navigation Links.
ScriptManager Class
ScriptManager Constructor
AllowCustomErrorsRedirect Property
AsyncPostBackError Event
AsyncPostBackErrorMessage Property
AsyncPostBackSourceElementID Property
AsyncPostBackTimeout Property
AuthenticationService Property
EnablePageMethods Property
EnablePartialRendering Property
EnableScriptGlobalization Property
EnableScriptLocalization Property
GetCurrent Method (page)
IsDebuggingEnabled Property
IsInAsyncPostBack Property
LoadPostData Method (postDataKey, postCollection)
LoadScriptsBeforeUI Property
OnAsyncPostBackError Method (e)
OnInit Method (e)
OnPreRender Method (e)
OnResolveScriptReference Method (e)
ProfileService Property
RaisePostDataChangedEvent Method
RegisterArrayDeclaration Method
RegisterArrayDeclaration Method (control, arrayName, arrayValue)
RegisterArrayDeclaration Method (page, arrayName, arrayValue)
RegisterAsyncPostBackControl Method (control)
RegisterClientScriptBlock Method
RegisterClientScriptBlock Method (control, type, key, script, addScriptTags)
RegisterClientScriptBlock Method (page, type, key, script, addScriptTags)
RegisterClientScriptInclude Method
RegisterClientScriptInclude Method (control, type, key, url)
RegisterClientScriptInclude Method (page, type, key, url)
RegisterClientScriptResource Method
RegisterClientScriptResource Method (control, type, resourceName)
RegisterClientScriptResource Method (page, type, resourceName)
RegisterDataItem Method
RegisterDataItem Method (control, dataItem)
RegisterDataItem Method (control, dataItem, isJsonSerialized)
RegisterDispose Method (control, disposeScript)
RegisterExpandoAttribute Method (control, controlId, attributeName, attributeValue, encode)
RegisterExtenderControl Method (extenderControl, targetControl)
RegisterHiddenField Method
RegisterHiddenField Method (control, hiddenFieldName, hiddenFieldInitialValue)
RegisterHiddenField Method (page, hiddenFieldName, hiddenFieldInitialValue)
RegisterOnSubmitStatement Method
RegisterOnSubmitStatement Method (control, type, key, script)
RegisterOnSubmitStatement Method (page, type, key, script)
RegisterPostBackControl Method (control)
RegisterScriptControl Method (scriptControl)
RegisterScriptDescriptors Method
RegisterScriptDescriptors Method (extenderControl)
RegisterScriptDescriptors Method (scriptControl)
RegisterStartupScript Method
RegisterStartupScript Method (control, type, key, script, addScriptTags)
RegisterStartupScript Method (page, type, key, script, addScriptTags)
Render Method (writer)
ResolveScriptReference Event
ScriptMode Property
ScriptPath Property
Scripts Property
Services Property
SetFocus Method
SetFocus Method (clientID)
SetFocus Method (control)
SupportsPartialRendering Property
Visible Property

RegisterAsyncPostBackControl Method (control)

Registers a control for asynchronous postbacks, which can be used to update specific regions of the page .

Syntax

CSharp

public void RegisterAsyncPostBackControl (
	Control control
)

VisualBasic

Public Sub RegisterAsyncPostBackControl ( _
	control As Control _
)

ManagedCPlusPlus

public:
virtual void RegisterAsyncPostBackControl (
	Control^ control
) sealed

JSharp

public final void RegisterAsyncPostBackControl (
	Control control
)

Parameters

control (Control)

The Control control to register for asynchronous postbacks.

Remarks

The RegisterAsyncPostBackControl(Control) method enables you to register controls to perform an asynchronous postback instead of a synchronous postback which updates the entire page . When the ChildrenAsTriggers property of an UpdatePanel control is set to true (which is the default), postback controls inside the UpdatePanel control are automatically registered as asynchronous postback controls and cause a refresh of the panel content.

Use the RegisterAsyncPostBackControl(Control) method to register controls outside of an UpdatePanel control as postback controls that can perform asynchronous postbacks and potentially update the content of an update panel. To update an UpdatePanel control programmatically, call the Update() method.

If you want to register a control as a trigger for an UpdatePanel control, use the designer's UpdatePanelTrigger Collection Editor dialog box, or add the trigger declaratively by using the <Triggers> element of the UpdatePanel control.

Examples

The following example demonstrates how to call the RegisterAsyncPostBackControl(Control) method to register a Button control so that it causes an update of an UpdatePanel control's content. The Button control is not inside the UpdatePanel control. Two buttons are shown: Button1 and Button2. Button1 refreshes the content of the panel, while Button2 refreshes the entire page.

The following example demonstrates how to call the RegisterAsyncPostBackControl(Control) method to register a user control so that it causes an update of an UpdatePanel control's content. The first example shows a page using the user control. The second example shows the user control.

Controls

<%@ Control Language="C#" ClassName="WebUserControl" %>

<script runat="server">
    public event EventHandler InnerClick
    {
        add
        {
            UCButton1.Click += value;
        }
        remove
        {
            UCButton1.Click -= value;
        }
    }
    public String Name
    {
        get
        {
            return UCTextBox1.Text;
        }
    }
</script>

<asp:Panel ID="UCPanel1" runat="server" GroupingText="User Control">
    Enter your name:
    <asp:TextBox ID="UCTextBox1" runat="server"></asp:TextBox>
    <br />
    <asp:Button ID="UCButton1" runat="server" Text="Submit" />
</asp:Panel>

Controls

<%@ Control Language="VB" ClassName="WebUserControl" %>

<script runat="server">
    Public Custom Event InnerClick As EventHandler
        AddHandler(ByVal value As EventHandler)
            AddHandler UCButton1.Click, value
        End AddHandler

        RemoveHandler(ByVal value As EventHandler)
            RemoveHandler UCButton1.Click, value
        End RemoveHandler

        RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs)
        End RaiseEvent
    End Event

    Public ReadOnly Property Name() As String
        Get
            Return UCTextBox1.Text
        End Get
    End Property
</script>

<asp:Panel ID="UCPanel1" runat="server" GroupingText="User Control">
    Enter your name:
    <asp:TextBox ID="UCTextBox1" runat="server"></asp:TextBox>
    <br />
    <asp:Button ID="UCButton1" runat="server" Text="Submit" />
</asp:Panel>

Exceptions

ExceptionCondition
ArgumentNullException

The control argument is null.

ArgumentException

The page is registered as an asynchronous postback control.

ArgumentException

The registered control does not implement the INamingContainer, IPostBackDataHandler, or IPostBackEventHandler interfaces.

Assembly: System.Web.Extensions (Module: System.Web.Extensions)