ASP.NET动态加载主题示例
1.先制作两个主题Default和Blue App_Themes\Blue\Blue.skin: <asp:TextBox runat="server" BorderWidth="1px" BorderColor="Blue" ForeColor="Blue"></asp:TextBox>
2.动态加载主题
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> <title>动态加载主题示例-Mzwu.Com</title> </head> <body> <form id="form1" runat="server"> <div> <asp:Button ID="Button1" runat="server" PostBackUrl="?theme=default" Text="应用主题一" /> <asp:Button ID="Button2" runat="server" PostBackUrl="?theme=blue" Text="应用主题二" /><br /><br /> <asp:TextBox ID="TextBox1" runat="server" BorderWidth="1px" BorderColor="Black" ForeColor="Black"></asp:TextBox><br /> </div> </form> </body> </html> Default.aspx.cs: using System;using System.Data; using System.Configuration; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; public partial class _Default : System.Web.UI.Page { protected void Page_PreInit(object sender, EventArgs e) { if (Request.QueryString["theme"] != null) { Page.Theme = Request.QueryString["theme"]; } } protected void Page_Load(object sender, EventArgs e) { // } } ASP.NET主题说明 |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |