簡體   English   中英

在 gridview asp.net 中更改數據綁定

[英]change databound in gridview asp.net

如何通過databoud在gridview asp.net中更改顏色/背景色,我嘗試這樣我發現錯誤。 這個問題有什么解決方案。 謝謝

Private Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) 處理GridView1.RowDataBound

        If e.Row.RowType = DataControlRowType.DataRow Then
            If (e.Row.Cells(1).Text) = "102" Then
                e.Row.Cells(1).BackColor = System.Drawing.Color.Red
            End If
        End If
End Sub
if (e.Row.Cells[0].Text == "12")
          {
              e.Row.Cells[0].ForeColor = System.Drawing.Color.Red;
          }
else if(e.Row.Cells[0].Text == "13")
          {
              e.Row.Cells[0].ForeColor = System.Drawing.Color.Yellow;
          }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM