|
 |
|
|
Your article on themes is awesome. It really helped me a lot. Thanks for your post. My problem is, I need my website to allow themes as well as use ajax, so my asp.net imagebutton will not be the server control, it will be an img and onclick of the button i want to call a javascript function. Do you know, how to load the images accordingly to html img controls based on the theme. Thanks in advance... Please help me out. The css property background-image is not working, it shows a red cross just front of the image....
Abhishek Sur
Web Developer
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
Can someone somehow make it work without the server.tranfer?
I have used profiles in place of sessions. I would like my site to remember the theme selected by the user last time.
Web.config: =========== anonymousIdentification enabled="true"/ profile properties add name="Theme" defaultValue ="Green" allowAnonymous ="true"/ /properties /profile
SelectedIndexChanged event on Master file: ========================================== Profile.Theme = ddlTheme.SelectedValue; Server.Transfer(Request.FilePath);
On PreInit event on Base Page: ============================== base.OnPreInit(e); if (!String.IsNullOrEmpty(HttpContext.Current.Profile.GetPropertyValue("Theme").ToString())) { Page.Theme = HttpContext.Current.Profile.GetPropertyValue("Theme").ToString(); }
|
| Sign In·View Thread·PermaLink | 5.00/5 (1 vote) |
|
|
|
 |
|
|
The problem is, when you select an item in the radiobuttonlist. A postback event is fired. so the page is refreshed and in the selectedindexchanged there's a server.transfer. So the page is loaded twice in order to change the theme. I'm sure there's a better to handle this.
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
My web is like this:
MyWeb ---App_Code ------Theme.cs ------ThemeManager.cs ---App_Themes ------Blue ------Red ---Child ------childpage.aspx ---default.aspx ---masterpage.master
I have problem when i use HttpContext.Current.Server.MapPath("App_Themes") function in GetThemes method in ThemeManager.cs. It's work good when i access default.aspx page. But error when i access childpage.aspx page. At that time, HttpContext.Current.Server.MapPath("App_Themes") will refer to MyWeb/Child/App_Themes. So i can't get Theme list.
How can i fix this problem. Thank you very much!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
Thanks for your help, I've been trying to accomplish this for a while. Odd that such a key functionality was not implemented by MS.
Is there any easy way to persist the chosen theme across multiple sessions? Without storing your choice in a database?
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
dear , do u have spacific example about this .
rgards
MDaraghmeh .Net Developer Jordan- Amman 00962-78-452450 m-daraghmeh@hotmail.com
|
| Sign In·View Thread·PermaLink | 3.00/5 (1 vote) |
|
|
|
 |
|
|
 |
|
|
Anyone that know how or if it's possible to upload a new theme folder (w/skin file etc) without having to recompile the site and uploading /bin ?
Chao ab ordo
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
Just add a new theme to the Theme folder in the web server and you're done (since the theme radiobutton is populated based on this folder).
"Blessed is the man who finds wisdom, the man who gains understanding." Proverbs 3:13
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
Thanks Sue,
This is wat i wanted in my new project. But basically main issue is image. Is it must that we should access image by making them as image control in the skin file. Don't we put the path directly in the images or where needed.
Thank you, Manish Pansiniya maniish.wordpress.com[^]
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
Hi, Is it not possible to use PreInit of mater page instead of the Base page that is inherited by all pages. Thanks for the short tips anyway!!
Addisu H. Desta .NET Developer MCP, MCAD in .NET
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
请参考: http://www.codeproject.com/useritems/themeswitcher.asp?df=100&forumid=292951&select=1983760&msg=1983760
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
Nice article, my favorite kind: to the point, works and saves time.
One little tip that may or may not be dead obvious: If you have a reason to want to turn off the theming for testing, or because in our case the Telerik controls we use have a built in theme that is quite nice you just make an empty folder in your themes folder with a meaningful name like "NoTheme".
Cheers!
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
I spent some good hours trying to find out how smthng like this could be done. Thanks a lot, you look great btw. :->
sean
|
| Sign In·View Thread·PermaLink | 2.00/5 (1 vote) |
|
|
|
 |
|
|
Hi there,
As an alternative you can load a theme from global.asax.cs, like so:
Override Init() and add the following code:
PreRequestHandlerExecute += delegate(object appsender, EventArgs appargs) { Page page = HttpContext.Current.Handler as Page; if (page != null) page.PreInit += delegate(object pagesender, EventArgs pageargs) { (pagesender as Page).Theme = HttpContext.Current.Request.QueryString["theme"]; }; };
This will work with masterpages. I've kept the code compact, this is a silly example but it (hopefully) illustrates the point 
Cheers, Michel
|
| Sign In·View Thread·PermaLink | 3.50/5 (2 votes) |
|
|
|
 |
|
|
Thank you for posting this information. I looked in several places, but none had this approach, which is what I was looking for.
I do have one thing to add for anyone else who might want to change the StyleSheetTheme instead of just the Theme. In the Base.cs class I had to override the StyleSheetTheme property instead of the OnPreInit method.
Like this:
private string myTheme; public override string StyleSheetTheme { get { if (Session["MyTheme"] == null) { return "ThemeName"; } else { return (string)Session["MyTheme"]; } } set { myTheme = value; } }
Hope that helps any future visitors!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Thanks gweeter, for the info on setting the StyleSheetTheme instead of Theme! Googled for that for ages without any luck..
Also thanks to Sue for a great article!
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
Intread of this public Theme(string name) { Name = name; }
I'll use
public Theme(string name) { _name = name; }
Sice you're calling the Name's Set intead of just updating the local (and private) variable.
I'm on a Fuzzy State: Between 0 an 1
|
| Sign In·View Thread·PermaLink | 4.80/5 (2 votes) |
|
|
|
 |
|
|
Gonzalo Brusella wrote: I'm on a Fuzzy State: Between 0 an 1
Haaa haaa.... Holy Hell, thats a BIG bug mate ! Many people might call you crazy. But i know optimization during build/design has made more than 1000 times difference (usually O(log n)) in the past.
Abi ( Abishek Bellamkonda ) My Blog: http://abibaby.blogspot.com =(:*
|
| Sign In·View Thread·PermaLink | 3.00/5 (2 votes) |
|
|
|
 |
|
|
Sue, thanks for your article.
I suppose you could move the code from the BasePage to the MasterPage. This saves you from inheriting from BasePage in all your .aspx pages and makes the model even more easy.
|
| Sign In·View Thread·PermaLink | 1.00/5 (1 vote) |
|
|
|
 |
|
|
DeKale wrote: I suppose you could move the code from the BasePage to the MasterPage.
Actually, you can't. The MasterPage class lacks a PreInit event. To programmatically assign a theme, you have to do it in either the page itself, in a base page (as Sue is showing), or with an HttpModule.
|
| Sign In·View Thread·PermaLink | 4.40/5 (2 votes) |
|
|
|
 |