473,383 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

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

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.

Sep 21 '06 #1
1 8223
SkinID can only be assigned in PreInit which is where we also dynamically
assign Themes.

<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://clintongallagher.metromilwaukee.com/
MAP 43°2'17"N 88°2'37"W : 43°2'17"N 88°2'37"W

<st****************@gmail.comwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
>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.

Sep 21 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Cecil Westerhof | last post by:
With global.asa application variables can be set. Later can a script in your application change the value of those variables. But when IIS is restarted the old values are used again. Is there a way...
1
by: Bob Rosen | last post by:
I would like to place some button controls on a web page underneath a DataGrid control. Since the height of the DataGrid depends on the number of rows displayed, which is determined by user...
8
by: Thomas H. | last post by:
Hi folks, what's the best way to add (web)controls at runtime ?? TIA T.H.
2
by: Sam Kuehn | last post by:
There has been a lot of articles on how to load user controls at runtime in the Init() method. UserControl myControl = (UserControl)LoadControl(stringControl); I add the control in the Init()...
1
by: Mamatha | last post by:
Hi I have an application in VB.NET,in that application one form contains listbox(on the leftside of the form)and datagrid control(on the rightside of the form).Both controls displays data at...
0
by: Mr. Bean | last post by:
Hello, I'm making a small web application that allows the user to select a submit for one or more items. Is there a way to allow the user to add controls at runtime in the following manner: ...
7
by: Varangian | last post by:
Hello is creating controls at runtime the same as designtime ? will a page be faster if controls are created at designtime rather than at runtime ? If so why ? thanks :)
0
by: Derek Hart | last post by:
I am wanting to move and/or resize controls at runtime. I have download and integrated this application: http://www.codeproject.com/KB/miscctrl/CSharpRectTracker.aspx It is the C# Rect...
1
by: vingomail | last post by:
I want a sample code for how to retrieve the values of dynamically generated text box controls at runtime. One thing I ve more number of textbox controls and also generated ids for that controls. i...
1
by: brettokumar | last post by:
hi I want to know how to change the position of the web controls at runtime relative to some other control. by user like bbc.co.uk wat i hav to do for that plz share ur ideas
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.