GridView中的条件值 [英] Conditional Values in GridView
问题描述
亲爱的高手请帮助将asp经典转换为asp.net vb
< td width =50>< div align =right> ;
<%if status_conf =未选中然后%>
< img src =images / unchecked.jpgwidth =13height = 13border = 0>
<%elseif status_conf =是然后%>
< img src =images / led-1.jpgborder =0/>
<%elseif status_conf =否然后%>
< img src =images / led-2.jpg border =0/>
<%elseif status_conf =不同意然后%>
< img src =images / led-3.jpg border =0/>
<%elseif status_conf =InProgress然后%>
< img src =images / led-4。 jpgborder =0/>
<%elseif status_conf =通知然后%>
< img src =images / led-5 .jpgborder =0/>
<%end if if>< / div&g t;
< / td>
i使用此但不起作用
dear master please help convert asp classic to asp.net vb
<td width="50"><div align="right">
<%if status_conf="Unchecked " then%>
<img src="images/unchecked.jpg" width="13" height="13" border=0>
<%elseif status_conf="Yes " then%>
<img src="images/led-1.jpg" border="0"/>
<%elseif status_conf="No " then%>
<img src="images/led-2.jpg" border="0"/>
<%elseif status_conf="Disagree " then%>
<img src="images/led-3.jpg" border="0"/>
<%elseif status_conf="InProgress " then%>
<img src="images/led-4.jpg" border="0"/>
<%elseif status_conf="Notification" then%>
<img src="images/led-5.jpg" border="0"/>
<%end if%></div>
</td>
i use this but not works
<asp:TemplateField HeaderText="STATUS_CONF">
<ItemTemplate>
<asp:Image ID="gbr1" runat="server" />
</ItemTemplate>
</asp:TemplateField>
If e.Row.RowType = DataControlRowType.DataRow Then
Dim gbr As Image = CType(e.Row.FindControl("gbr1"), Image)
'Change this to work with the "ENTERED" flag later on...
If e.Row.DataItem("STATUS_CONF").ToString = "Unchecked" Then
gbr.ImageUrl = "~/images/unchecked.jpg"
ElseIf e.Row.DataItem("STATUS_CONF").ToString = "Yes" Then
gbr.ImageUrl = "~/images/led-1.jpg"
ElseIf e.Row.DataItem("STATUS_CONF").ToString = "No" Then
gbr.ImageUrl = "~/images/led-2.jpg"
ElseIf e.Row.DataItem("STATUS_CONF").ToString = "Disagree" Then
gbr.ImageUrl = "~/images/led-3.jpg"
ElseIf e.Row.DataItem("STATUS_CONF").ToString = "InProgress" Then
gbr.ImageUrl = "~/images/led-4.jpg"
ElseIf e.Row.DataItem("STATUS_CONF").ToString = "Notification" Then
gbr.ImageUrl = "~/images/led-5.jpg"
End If
End If
感谢您的帮助
toniajax @ yahoo.com
thanks for help
toniajax@yahoo.com
推荐答案
这篇关于GridView中的条件值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!