Page.Theme Proprietà

Definizione

Ottiene o imposta il nome del tema della pagina.

public:
 virtual property System::String ^ Theme { System::String ^ get(); void set(System::String ^ value); };
[System.ComponentModel.Browsable(false)]
public virtual string Theme { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.Theme : string with get, set
Public Overridable Property Theme As String

Valore della proprietà

Nome del tema della pagina.

Attributi

Eccezioni

È stato effettuato un tentativo di impostare la proprietà Theme dopo che si è verificato l'evento PreInit.

La proprietà Theme è impostata su un nome di tema non valido.

Esempio

Nell'esempio di codice seguente la Theme proprietà viene impostata su un nome passato nella stringa di query.

void Page_PreInit(object sender, EventArgs e)
{
  // Get the theme name from a QueryString variable
  string ThemeName;
  ThemeName = Request.QueryString["thename"];
  if (ThemeName != null)
  {
    Page.Theme = ThemeName;
  }
}
Public Sub Page_PreInit(ByVal Sender As Object, ByVal e As EventArgs)
      
  ' Get the theme name from a QueryString variable
  Dim ThemeName As String
  ThemeName = Request.QueryString("thename")
  If ThemeName <> Nothing Then
    Page.Theme = ThemeName
  End If
End Sub

Commenti

La Theme proprietà imposta il nome del tema utilizzato per la pagina. Se si desidera che le impostazioni nella pagina prendano la precedenza sulle impostazioni nel tema, utilizzare la StyleSheetTheme proprietà . Per altre informazioni, vedere ASP.NET Temi e interfacce.

La Theme proprietà deve essere impostata prima dell'evento. L'impostazione PreInit della Theme proprietà dopo l'evento genererà un'eccezione PreInitInvalidOperationException .

Il tema specificato deve esistere come applicazione o come tema globale. Se il tema non esiste, viene generata un'eccezione HttpException .

Si applica a

Vedi anche