我的GridView控件不使用的控制,因为它是填充使用表达式更改基于模板列的GridView行的颜色,不受管制
<asp:TemplateField HeaderText="As Of Sales">
<ItemTemplate>
<%#Getsales(Decimal.Parse(Eval("asofsales").ToString())).ToString("C0")%>
</ItemTemplate>
<FooterTemplate>
<%#Getsales1().ToString("C0")%>
</FooterTemplate>
<FooterStyle Font-Bold="True" />
</asp:TemplateField>
我想比较列索引1和列索引8,如果8更大然后1它应该是一个不同的字体颜色。
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
Dim x As String
x = e.Row.Cells(1).Text
Dim y As String
y = e.Row.Cells(8).Text
If Convert.ToInt32(x) <= Convert.ToInt32(y) Then
e.Row.ForeColor = System.Drawing.Color.Blue
End If
End If
End Sub
那么你发布的代码的实际问题是什么? – TheGeekYouNeed 2011-02-25 22:14:52
多数民众赞成在我想什么时,我写了它,但它并没有比较两列,因为颜色不变 – MyHeadHurts 2011-02-26 14:23:37