c# - Adding CSS Class to client side hyperlink on code behind -


i have list of links :

<ul>     <li><a href="#">aktuel</a></li>     <li><a href="#">business</a></li>     <li><a href="#">common</a></li>     <li><a href="#">extras</a></li> </ul> 

i have add css class 1 of links. have in codebehind c#. result should :

.... <li><a href="#" class="active">business</a></li> .... 

on life cycle event should , how?

note : cant change html design.

thanx in advance.

you can register clientscript.registerstartupscript on codebehind, run jquery script , job.

complete solution, including asp.net bit:

string jsscript = "$(function () { $(\"a:contains('aktuel')\").addclass(\"active\"); });";  clientscript.registerstartupscript(typeof(page), "anythingyoufancy", jsscript, true); 

you can check working here (not asp.net part tough):

http://jsfiddle.net/jwkae/


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -