我有一个像
这样的字符串HTML代码 <table id='topInfoBar' style=" width: 100%;" cellspacing='0' border='0'>
<Tr>
<td id='lockOrder' clientidmode='static' style="text-align:Right;color:black;font-weight:bold">
<img src='.../images/locked.gif' alt='This order is locked' title='This order is locked!' />
</td>
</Tr>
</table>
我想检查字符串中是否存在id 'lockOrder',如果是,则要替换img节点,即
<img src='.../images/locked.gif' alt='This order is locked' title='This order is locked!' />
带
<i class="fa fa-search fa-2x cursorpointer" title="This order is locked"></i>
希望在c#中完成。
答案 0 :(得分:1)
使用属性Visible
并在
HTML
<table id='topInfoBar' style="width: 100%;" cellspacing='0' border='0'>
<Tr>
<td id='lockOrder' clientidmode='static' style="text-align: Right; color: black; font-weight: bold">
<img src='.../images/locked.gif' alt='This order is locked' title='This order is locked!' runat="server" id="img"/>
<i class="fa fa-search fa-2x cursorpointer" title="This order is locked" runat="server" id="i" Visible="False"></i>
</td>
</Tr>
</table>
CodeBehind C#
if (true)
{
img.Visible = false;
i.Visible = true;
}