0

I have wrote a client side code in server side code like this:

 strHTMLGrid = strHTMLGrid + "<link rel='shortcut icon' href='/EVServer/Images/favicon.ico'/> \n";

This code looks like this in client side:

<link rel="shortcut icon" href="/EVServer/Images/favicon.ico" />

On executing the HTML file dynamically it comes like this:

<link rel='shortcut icon' href='/EVServer/Images/favicon.ico'/>

What to add in code behind so that i can get like this in my HTML file dynamically.Like this below in C#:

<link rel="shortcut icon" href="/EVServer/Images/favicon.ico" />
BogadoDiego
  • 329
  • 3
  • 7
Basant Gera
  • 103
  • 3
  • 16

1 Answers1

0

You can set the favicon from code behind.Just add a runat="server" attribute to the <link> element and you will be able to access it from code.

.ASPX:

<link id="favIcon" runat="server" rel="shortcut icon" />

Code behind:

protected void Page_Load(object sender, EventArgs e)
{
    favIcon.Attributes["href"] = "/EVServer/Images/favicon.ico";
}
Denys Wessels
  • 16,829
  • 14
  • 80
  • 120