web.config
<configuration>
<appSettings>
<add key='CSS1' value='StyleSheet1.css' />
</appSettings>
</configuration>
.aspx
<link id='link1' runat='server'/>
VB.NET
Dim lnk As New System.Web.UI.HtmlControls.HtmlGenericControl('lnk')
lnk = CType(Me.Page.FindControl('link1'), System.Web.UI.HtmlControls.HtmlGenericControl)
lnk.Attributes.Add('rel', 'stylesheet')
lnk.Attributes.Add('href', ConfigurationSettings.AppSettings('CSS1').ToString())
lnk.Attributes.Add('type', 'text/css')
C#
System.Web.UI.HtmlControls.HtmlGenericControl lnk =new System.Web.UI.HtmlControls.HtmlGenericControl ('lnk') ;
lnk =(System.Web.UI.HtmlControls.HtmlGenericControl ) this.Page.FindControl( 'link1') ;
lnk.Attributes.Add ('rel', 'stylesheet');
lnk.Attributes.Add ('href', ConfigurationSettings.AppSettings['CSS1'].ToString()) ;
lnk.Attributes.Add ('type','text/css');
Share with