Wednesday, December 14, 2011

How to set colour of particular gridview cell in asp.net


in .aspx page

  <asp:GridView ID="GridView1" runat="server">
        </asp:GridView>

in .cs page  

protected void Page_Load(object sender,EventArgs e)
{
       String a;
        a = "test"
        GridView1.DataSource = a;
        GridView1.DataBind();
       GridView1.Rows(0).Cells(0).BackColor = Drawing.Color.Cyan;
}


you  can  adjust color in any cells of gridview by adjusting Rows(2).Cells(1)

No comments:

Post a Comment