DynamicDataManager.RegisterControl Método

Definición

Registra un control DynamicDataManager.

Sobrecargas

RegisterControl(Control)

Registra un control con el control DynamicDataManager.

RegisterControl(Control, Boolean)

Registra un control con el control DynamicDataManager.

RegisterControl(Control)

Registra un control con el control DynamicDataManager.

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)

Parámetros

control
Control

Control de datos que debe registrarse.

Ejemplos

En el ejemplo siguiente se muestra cómo registrar un System.Web.UI.WebControls.GridView control en el Page_Init método de una página web de ASP.NET.

<%@ 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>

Comentarios

Para habilitar el comportamiento dinámico en un control, debe registrarlo.

Se aplica a

RegisterControl(Control, Boolean)

Registra un control con el control DynamicDataManager.

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)

Parámetros

control
Control

Control de datos que debe registrarse.

setSelectionFromUrl
Boolean

Es true para usar la clave principal a fin de establecer el elemento seleccionado; de lo contrario, no se establece el elemento seleccionado.

Comentarios

El registro del control permite su comportamiento dinámico. Si el setSelectionFromUrl parámetro es true y el valor de clave principal se encuentra en los valores de ruta, se usará la clave principal para establecer el elemento seleccionado. Normalmente, el valor de clave principal se pasa en la ruta mediante la cadena de consulta en la dirección URL de la solicitud.

Se aplica a