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

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top