Click here to Skip to main content
15,890,506 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello

In my web site I want to get changes on my webpage for particular seconds based on my existing css classes.

that css class path getting from database that's why I want to to pass this path into href attribute in my asp page design.

ex link like
ASP.NET
<link href="mycss.css" rel="Stylesheet" type="text/css"  runat="server"/>

process like this
step1
that cs file geting value from database
step 2

Here in this href location i want to call value from cs file

Any body help me on this.
Posted
Updated 16-Nov-11 20:00pm
v2

1 solution

Step 1 -

Have a look at below link to fetch your Data from SQL Server Database.

http://msdn.microsoft.com/en-us/library/bh8kx08z.aspx

Step 2 -

Fetch your details from Database in Page_Init Event and register your CSS reference as below.
C#
protected void Page_Init(object sender, EventArgs e)
{
  //Fetch your CSS Href details from Datbase here.	 
  string cssHrefFromDB = "cssHrefFromDB";
  
  HtmlLink cssDynamic = new HtmlLink();
  cssDynamic.Href = cssHrefFromDB;
  cssDynamic.Attributes["rel"] = "stylesheet";
  cssDynamic.Attributes["type"] = "text/css";
  cssDynamic.Attributes["media"] = "all";
  Page.Header.Controls.Add(cssDynamic);

}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900