Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
当我尝试使用“InnerHtml”添加动态图像时,我的 sql 数据库中有图像路径存储,它不能像这样使用 HTML 代码
<div runat=server class="ws_images" id="List_Slide"> </div>
像这样的C#代码
List_Slide.InnerHtml = "<li><img src=data1/images/31.jpg alt=31 title=31 id=wows1_0/> </li>"
您可以在后面的代码中添加一个 withrunat="Server"并设置 'src' 属性:
runat="Server"
HTML:
<img runat="server" id="img31" />
CS:
((HtmlImage)img31).Src = "data1/images/31.jpg";