DynamicDataManager.RegisterControl Metodo

Definizione

Registra un DynamicDataManager controllo .

Overload

Nome Descrizione
RegisterControl(Control)

Registra un controllo con il DynamicDataManager controllo .

RegisterControl(Control, Boolean)

Registra un controllo con il DynamicDataManager controllo .

RegisterControl(Control)

Registra un controllo con il DynamicDataManager controllo .

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)

Parametri

control
Control

Controllo dati da registrare.

Esempio

Nell'esempio seguente viene illustrato come registrare un controllo nel metodo />

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

Commenti

Per abilitare il comportamento dinamico in un controllo, è necessario registrarlo.

Si applica a

RegisterControl(Control, Boolean)

Registra un controllo con il DynamicDataManager controllo .

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)

Parametri

control
Control

Controllo dati da registrare.

setSelectionFromUrl
Boolean

true per utilizzare la chiave primaria per impostare l'elemento selezionato; in caso contrario, l'elemento selezionato non è impostato.

Commenti

La registrazione del controllo abilita il comportamento dinamico. Se il setSelectionFromUrl parametro è true e il valore della chiave primaria viene trovato nei valori di route, la chiave primaria verrà usata per impostare l'elemento selezionato. Il valore della chiave primaria viene in genere passato nella route usando la stringa di query nell'URL della richiesta.

Si applica a