html - How to convert string value to HTMLAnchor in c# -



have 100 tags in web page each tag represents real world desktop. have live status of each system in database (online/offline data). if system online want add css class to

.online{      color: #fff;      background-color: #5cb85c;      border-color: #4cae4c;  }

tag.

i defined id value of appropriate system name of particular system.

<a id="comzk12"></a>

now want add online class particular tag using c#.

string id=datarow["comname"].tostring();;//i'm getting system name db     if(status=="online")     {         id.attributes.add("class","online");//id value comzk12.     } 

but can't use above code because line

id.attributes.add("class","online");

id string. id of tag htmlanchor. can't convert string htmlanchor.

how achieve ?

you can use linkbutton / htmlanchor id getting database, can use cssclass instead of adding attribute class.

linkbutton lb = new linkbutton(); lb.id = datarow["comname"].tostring();;   if(status=="online") {     lb.attributes.add("class","online");//id value comzk12. } 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -