WithFlyingColors
WithFlyingColors

Reputation: 2780

How to set SkinID programmatically with the control?

<%@ Page Title="" Language="C#" MasterPageFile="~/YourGuruMaster.master" AutoEventWireup="true" CodeFile="AnswerQuestion.aspx.cs" Inherits="AnswerQuestion" StylesheetTheme="AnswerDesign"%>

My skin file:

My code behind:

 Label title;
void Page_PreInit(object sender, EventArgs e)
{
    title = new Label();
    title.SkinID = "Blue";
}

  protected void Page_Load(object sender, EventArgs e)
{
  title.Text = QuestionRequest;
        PlaceHolder2.Controls.Add(title);
}

Upvotes: 0

Views: 1841

Answers (2)

IUnknown
IUnknown

Reputation: 22478

As I understand, you have add skin file named Blue. This is not the SkinID. Actually this file can have any name bu you must set SkinID property value in each control skin definition if you don't want to use the default. Did you read autogenerated comment at the top of skin file?

Upvotes: 0

platon
platon

Reputation: 5340

Set the page's Theme property to the "AnswerDesign" instead of StyleSheetTheme to resolve the problem. Also, make certain that this theme contains the Blue skin.

UPDATE Change the code as follows:

// OLD CODE

... StylesheetTheme="AnswerDesign"%

// NEW CODE

... Theme="AnswerDesign"%

Upvotes: 0

Related Questions