Getting value from a cell from a gridview on RowDataBound event

前端 未结 12 1043
[愿得一人]
[愿得一人] 2020-12-23 16:48
string percentage = e.Row.Cells[7].Text;

I am trying to do some dynamic stuff with my GridView, so I have wired up some code to the RowDataBound ev

12条回答
  •  感动是毒
    2020-12-23 17:51

    Just use a loop to check your cell in a gridview for example:

    for (int i = 0; i < GridView2.Rows.Count; i++)
    {
        string vr;
        vr = GridView2.Rows[i].Cells[4].Text; // here you go vr = the value of the cel
        if (vr  == "0") // you can check for anything
        {
            GridView2.Rows[i].Cells[4].Text = "Done";
            // you can format this cell 
        }
    }
    

提交回复
热议问题