#1
  1. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2003
    Posts
    879
    Rep Power
    11

    Exclamation C# with asp.net highlighting gridview rows


    Hi

    I have a gridview that is binded to a stored proc. I highlight the rows depending on the result. So after displaying the result, I loop through the rows and highlight those that meet the critera

    here's the code for highlighting:
    private void HLightRows()
    {
    for(int=0;i<gdView.Rows.Count;i++){
    totaltime = timespan.parse(gdView.Rows[i].Cells[2].Text));
    if(totaltime.totalseconds >= 1800){
    gdView.BackColor = Color.Red;
    }

    }
    }

    it highlights fine, but the problem is when I set the gridview AllowPaging = true, after I click on the second page the highlight is gone as well as when I go back to the first page.
    I tried putting the HLightRow function to PageIndexChanged and PageIndexChanging Event but still it won't highlight the rows.
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2013
    Posts
    16
    Rep Power
    0
    I believe that to read some tutorial on the gridview would be helpful, like the gridview row color change.

IMN logo majestic logo threadwatch logo seochat tools logo