.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Imran Ghani
Sohaib Khalid

Home >> Code Snippets >> ASP.NET Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Get Themes List and Apply Themes at Runtime in ASP.Net

Posted By:Sasi Prabhu       Posted Date: July 06, 2011    Points: 40    Category: ASP.NET Controls    URL: http://www.dotnetspark.com  

below code shows how to Apply the Themes at Runtime in asp.net website or application

To List the Themes into RadioButtonList :

Protected void Page_Load(object sender,EventArgs e)

if(!IsPostBack) { System.IO.DirectoryInfo ThemeInfo=new System.IO.DirectoryInfo(Server.MapPath("App_Themes")); ThemeRadioButtonList.DataSource=ThemeInfo.GetDirectories(); ThemeRadioButtonList.DataTextField="Name"; ThemeRadioButtonList.DataValueField="Name"; ThemeRadioButtonList.DataBind(); } }

Set ThemeRadioButtonList AutoPostBack Property as True.

Store the ThemeName into Session for that

Protected void ThemeRadioButtonList_SelectedIndexChanged(object sender,EventArgs e)

To Apply Theme :

protected void Page_PreInit(object sender,EventArgs e)
catch(Exception ex)


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend