C# 如何用带有空td的元素替换td
嗨,我有一个像C# 如何用带有空td的元素替换td,c#,asp.net,C#,Asp.net,嗨,我有一个像 <td valign="top" style="width:150px;" > <img alt="<recipetitle/>" src="http://<rootweburl/>/photos/recipes/Large/<recipephotoname/>" alt="logo" style="float:left;"/> </td> /照片/食谱/大号/“alt=”logo“styl
<td valign="top" style="width:150px;" >
<img alt="<recipetitle/>" src="http://<rootweburl/>/photos/recipes/Large/<recipephotoname/>" alt="logo" style="float:left;"/>
</td>
/照片/食谱/大号/“alt=”logo“style=”float:左;"/>
其中
和
是参数,可以更改。我想用空td替换此td。在C#中,我将如何执行此操作?您需要将表单元格设置为服务器端控件,以便您可以从代码隐藏处访问它
<table>
<tr>
<td valign="top" style="width:150px;" runat="server" id="tdToBeCleared">
<img alt="<recipetitle/>" src="http://<rootweburl/>/photos/recipes/Large/<recipephotoname/>" alt="logo" style="float:left;"/>
</td>
</tr>
</table>
编辑:刚刚更改了td以与您的示例相匹配,您可以简单地复制和粘贴。备选方案-以相同的方式将图像设置为服务器控件,并操作其
可见属性。
tdToBeCleared.InnerHtml = string.Empty;