How to change a controls SkinID at runtime (asp.net 2.0)

  • Thread starter Thread starter stephen.mcallister
  • Start date Start date
S

stephen.mcallister

I am toying around with Personalization in asp.net 2.0 and would like
my users to be able to choose a SkinID at runtime.
I have a theme with a default gridview skin and a custom skin.
There are 2 buttons on a Control that I was hoping I could use to
switch the SkinID, but it appears it's not that easy to do during
runtime.

Here is the code I tried to use

protected void imgBtnDefaultColour_Click(object sender,
ImageClickEventArgs e)
{

gvReqListing.SkinID = "";

}
protected void imgBtnSecondColour_Click(object sender,
ImageClickEventArgs e)
{
gvReqListing.SkinID = "gvWebPart";

}

and the error message that I received

The 'SkinId' property cannot be changed dynamically if Page has a
stylesheet theme. For dynamic controls, set the property before calling
ApplyStyleSheetSkin().

Any help or suggestions would be greatly appreciated.
 
Back
Top