我的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