JavaScript Editor jscript editor     Web designer 



Main Page

In addition to specifying theme and skin preferences in page declarations and configuration files, you can apply themes programmatically. You can set both page themes and style sheet themes programmatically; however, the procedure for applying each type of theme is different.

To apply a page theme programmatically

  • In a handler for the page's PreInit method, set the page's Theme property.

    The following code example shows how to set a page's theme conditionally based on a value passed in the query string.

    Visual BasicВ CopyCode imageCopy Code
    Protected Sub Page_PreInit(ByVal sender As Object, _
            ByVal e As System.EventArgs) _
            Handles Me.PreInit
        Select Case Request.QueryString("theme")
            Case "Blue"
                Page.Theme = "BlueTheme"
            Case "Theme2"
                Page.Pink = "PinkTheme"
        End Select
    End Sub

    C#В CopyCode imageCopy Code
    Protected void Page_PreInit(object sender, EventArgs e)
    {
        switch (Request.QueryString["theme"])
        {
            case "Blue":
                Page.Theme = "BlueTheme";
                break;
            case "Pink":
                Page.Theme = "PinkTheme";
                break;
        }
    }

To apply a style sheet theme programmatically

  • In the page's code, override the StyleSheetTheme property and in the get accessor, return the name of the style sheet theme.

    The following code example shows how to set a theme named BlueTheme as the style sheet theme for a page:

    Visual BasicВ CopyCode imageCopy Code
    Public Overrides Property StyleSheetTheme() As String
       Get
           Return "BlueTheme "
       End Get
       Set(ByVal value As String)
       End Set
    End Property

    C#В CopyCode imageCopy Code
    public override String StyleSheetTheme
    {
      get { return "BlueTheme "; }
    }

To apply control skins programmatically

  • In a handler for the page's PreInit method, set the control's SkinID property.

    The following code example shows how to set the SkinID property of a Calendar control.

    Visual BasicВ CopyCode imageCopy Code
    Sub Page_PreInit(ByVal sender As Object, _
            ByVal e As System.EventArgs) _
            Handles Me.PreInit
        Calendar1.SkinID = "BlueTheme"
    End Sub

    C#В CopyCode imageCopy Code
    void Page_PreInit(object sender, EventArgs e)
    {
        Calendar1.SkinID = "MySkin";
    }

See Also



JavaScript Editor jscript editor     Web designer 
Bitcoin Dice - Crypto Casino . http://www.cashadvance-loans.net