How do I change color of row in GridView without a GridView event being fired?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Laila2008
    New Member
    • Jan 2008
    • 4

    How do I change color of row in GridView without a GridView event being fired?

    Hi,

    I am trying to update data and highlight updated row in a GridView.

    To change the data I loop through the dataset, find the row I want, set the new data and call DataBind() on the GridView.
    To change row color I loop through the GridView, find the row and update color.

    But this involves 2 loops! Once through the underlying dataset and once through GridView... not clean at all. Any ideas?

    Thanks!
  • nateraaaa
    Recognized Expert Contributor
    • May 2007
    • 664

    #2
    Originally posted by Laila2008
    Hi,

    I am trying to update data and highlight updated row in a GridView.

    To change the data I loop through the dataset, find the row I want, set the new data and call DataBind() on the GridView.
    To change row color I loop through the GridView, find the row and update color.

    But this involves 2 loops! Once through the underlying dataset and once through GridView... not clean at all. Any ideas?

    Thanks!
    This example may help you.

    Nathan

    Comment

    • kunal pawar
      Contributor
      • Oct 2007
      • 297

      #3
      You can set Properties like Style or Css to show row colored

      Comment

      • jawaharks
        New Member
        • Jan 2008
        • 12

        #4
        HI,
        you can also set the editrowstyle and SelectedRowStyl e attribute for the gridview...

        Comment

        Working...