Public Overridable Property Theme As String
Dim instance As Page Dim value As String value = instance.Theme instance.Theme = value
public virtual string Theme { get; set; }
public: virtual property String^ Theme { String^ get (); void set (String^ value); }
/** @property */ public String get_Theme () /** @property */ public void set_Theme (String value)
public function get Theme () : String public function set Theme (value : String)
InvalidOperationException
Theme 在 PreInit 事件后设置。
HttpException
Theme 被设置为无效的主题名称。
Theme 属性设置用于该页的主题的名称。
Theme 属性只能在 PreInit 事件之前进行设置;在 PreInit 事件之后设置 Theme 属性将引发 InvalidOperationException 异常。
指定的主题必须作为应用程序主题或全局主题存在。如果该主题不存在,则将引发 HttpException 异常。
下面的代码示例将 Theme 属性设置为在查询字符串中传递的名称。
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
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; } }
Windows 98、Windows 2000 SP4、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。