注意:此属性在 .NET Framework 2.0 版中是新增的。
获取或设置页主题的名称。
命名空间:System.Web.UI
程序集:System.Web(在 system.web.dll 中)
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)
属性值
页主题的名称。
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 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
.NET Framework
受以下版本支持:2.0