ASP.NET - A simple way to change dinamically the css link

in the asp page we can make the link tag to be maintained from the server side
ink id="css" runat="server"  rel="stylesheet" type="text/css" 
and then we can change it dynamic
Sub Page_Load(Sender As Object, E As EventArgs)
If Not (Page.IsPostBack) Then
css.Attributes.Add("href","/.css")
End If
End Sub

This the easiest way to do it. Here is more complex css management in the Scott Gu' Blog:
http://weblogs.asp.net/scottgu/archive/2006/05/02/CSS-Control-Adapter-Toolkit-for-ASP.NET-2.0-.aspx

No comments:

Post a Comment