我想向包含文本和图像的 gridview 添加标签

I would like to add a label to a gridview that includes text and and image

我想在满足特定条件时向网格视图添加 link 和图像。

我认为可以使用下面的代码来完成,但我对“去哪里,我知道其中一些需要是 \”感到困惑,但我不确定在哪里。目前无法编译,请有人帮我解决这个问题吗?

我也研究过使用图像按钮,但在我的情况下这种方式似乎更复杂,因为按钮应该只出现在符合条件的行中。如果您认为该方法更好,我愿意改用该方法。

if(line.SuperSessionIndicator == "1" || line.ErrorType =="S" )
            {

             lbl3.Text = "<aref=\" \">"<img url='Images/Prop.png\'/>\"\"<a/>"; 

            }

您需要使用以下代码才能正确使用。

lbl3.Text = "<a href=\""><img src='Images/Prop.png\'/><a/>";

从上面的 C# 代码生成的标记如下所示,看起来是正确的。

<a href=""><img src='Images/Prop.png'/><a/>