如何在asp.net C#中使用多个主题? [英] How to Use more then one theme in asp.net C#?
本文介绍了如何在asp.net C#中使用多个主题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在asp.net C#中处理多个主题?
就像我必须切换旧主题并新建它们
解决方案
主题可以3种方式应用
1.文件夹级别
2.应用程序级别
3.页面级别。
如果你想根据条件切换你可以申请的主题。
以预定方式应用页面主题
switch (Request.QueryString [ theme])
{
case Blue :
Page.Theme = BlueTheme;
break ;
case Pink :
Page.Theme = PinkTheme;
break ;
}
< b>以编程方式应用控件外观< / b >
ControlerID.SkinID = CustomSkin;
Rad这里
如何在asp.net中动态更改页面主题 [< a href =http://www.codeproject.com/Articles/29414/How-to-change-Page-theme-dynamically-in-asp-nettarget =_ blanktitle =New Window> ^ ]
ASP.NET C#主页/主题/皮肤与会话 [ ^ ]
< blockquote>
public class 全局:System.Web.HttpApplication
{
protected void Application_PostMapRequestHandler( object sender,EventArgs e)
{
Page activePage = HttpContext.Current.Handler as Page;
if (activePage == null )
{
返回跨度>;
}
activePage.PreInit
+ =(s,ea)= >
{
string selectedTheme = HttpContext.Current.Session [ SelectedTheme] as string ;
if (Request.Form [ ctl00
How To handle more then one theme in asp.net C#?
Like i have to do switch on old theme and new them
解决方案 Themes can be applied in 3 ways
1. Folder Level
2. Application Level
3. Page Level.
if u want to switch the themes you can apply based on the condition.
To apply a page theme progmatically
switch (Request.QueryString["theme"])
{
case "Blue":
Page.Theme = "BlueTheme";
break;
case "Pink":
Page.Theme = "PinkTheme";
break;
}
<b>To apply control skins programmatically</b>
ControlerID.SkinID = "CustomSkin";
Rad here
How to change Page theme dynamically in asp.net[^]
ASP.NET C# Master Page/Theme/Skin with Session[^]
public class Global : System.Web.HttpApplication
{
protected void Application_PostMapRequestHandler(object sender, EventArgs e)
{
Page activePage = HttpContext.Current.Handler as Page;
if (activePage == null)
{
return;
}
activePage.PreInit
+= (s, ea) =>
{
string selectedTheme = HttpContext.Current.Session["SelectedTheme"] as string;
if (Request.Form["ctl00
这篇关于如何在asp.net C#中使用多个主题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文