Editar

Compartilhar via


DynamicDataManager.RegisterControl Method

Definition

Registers a DynamicDataManager control.

Overloads

RegisterControl(Control)

Registers a control with the DynamicDataManager control.

RegisterControl(Control, Boolean)

Registers a control with the DynamicDataManager control.

RegisterControl(Control)

Registers a control with the DynamicDataManager control.

public:
 void RegisterControl(System::Web::UI::Control ^ control);
public void RegisterControl (System.Web.UI.Control control);
member this.RegisterControl : System.Web.UI.Control -> unit
Public Sub RegisterControl (control As Control)

Parameters

control
Control

The data control to register.

Examples

The following example shows how to register a System.Web.UI.WebControls.GridView control in the Page_Init method of an ASP.NET Web page.

<%@ Page Language="C#" MasterPageFile="~/Site.master" %>

<script runat="server">

    protected void Page_Init(object sender, EventArgs e) {
        DynamicDataManager1.RegisterControl(GridView1);
    }

</script>



<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <h1> DynamicDataManager VB Sample</h1>
    
    <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" 
        AutoLoadForeignKeys="true" />
    
    <asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource" AllowPaging="True"
        AllowSorting="True" CssClass="gridview">
    </asp:GridView>
    
    <asp:LinqDataSource ID="GridDataSource" runat="server" EnableDelete="true">
       
    </asp:LinqDataSource>
    
</asp:Content>
<%@ Page Language="VB" MasterPageFile="~/Site.master" %>

<script runat="server">

    Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
        DynamicDataManager1.RegisterControl(GridView1)
    End Sub

</script>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
        
<h1> DynamicDataManager CS Sample</h1>

    <asp:DynamicDataManager ID="DynamicDataManager1" runat="server"
         AutoLoadForeignKeys="true" />

    <asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource"
        AllowPaging="True" AllowSorting="True" CssClass="gridview">
    </asp:GridView>

    <asp:LinqDataSource ID="GridDataSource" runat="server" EnableDelete="true">
    </asp:LinqDataSource>
    
</asp:Content>

Remarks

To enables dynamic behavior in a control, you must register it.

Applies to

RegisterControl(Control, Boolean)

Registers a control with the DynamicDataManager control.

public:
 void RegisterControl(System::Web::UI::Control ^ control, bool setSelectionFromUrl);
public void RegisterControl (System.Web.UI.Control control, bool setSelectionFromUrl);
member this.RegisterControl : System.Web.UI.Control * bool -> unit
Public Sub RegisterControl (control As Control, setSelectionFromUrl As Boolean)

Parameters

control
Control

The data control to register.

setSelectionFromUrl
Boolean

true to use the primary key to set the selected item; otherwise, the selected item is not set.

Remarks

Registering the control enables its dynamic behavior. If the setSelectionFromUrl parameter is true and the primary key value is found in the route values, the primary key will be used to set the selected item. The primary key value is typically passed in the route by using the query string in the request URL.

Applies to