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
Post a Comment