gridview

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nehaneha
    New Member
    • Nov 2007
    • 7

    gridview

    iam taking first value of label and comparing with rest of values if it is same then i want to change the color of that row.
    but what is happening is entire gridview backcolor is changing to red.

    i want to change only those rows which matches.

    void GridView1_DataB ound(object sender, EventArgs e)
    {
    foreach (GridViewRow gv in GridView1.Rows)
    {

    Label lbl = (Label)gv.Cells[2].Controls[0].FindControl("L abel1");
    string t = lbl.Text;
    for (int i = 0; i < GridView1.Rows. Count; i++)
    {
    Label lbl4 = (Label)GridView 1.Rows[i].Cells[2].Controls[0].FindControl("L abel1");
    if (t == lbl4.Text)
    {
    GridView1.Rows[i].Cells[2].BackColor = System.Drawing. Color.Red;

    //gv.BackColor = System.Drawing. Color.Red;

    }

    }

    }


    }
  • iburyak
    Recognized Expert Top Contributor
    • Nov 2006
    • 1016

    #2
    Please, move this to appropriate forum.

    Comment

    Working...