problems with datagridview rowheader value

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • yahooguy
    New Member
    • Apr 2010
    • 2

    problems with datagridview rowheader value

    I have an application where a datagridview is used to display some data, a datatable is bounded to it, and i want to put some text in the front of some rows to indicate that they are different from others.

    my code checks the rows and used the following

    mydatagridview. Rows.Item(iCnt) .HeaderCell.Val ue = "A"

    to set the row header values, it was fine when the data was first loaded. however, when I sort the datagridview by clicking the column header, these rowheadercell values disappear...

    anybody knows how to keep the row header values after the sorting? thanks a lot!!
  • semomaniz
    Recognized Expert New Member
    • Oct 2007
    • 210

    #2
    you will have to do this while binding the data. Create a OnDataBinding event to handle it

    Comment

    • yahooguy
      New Member
      • Apr 2010
      • 2

      #3
      Originally posted by semomaniz
      you will have to do this while binding the data. Create a OnDataBinding event to handle it
      thanks! so my understanding is that the header text is not bound to the gridview datasource, and sorting will erase all the older rows in the gridview, and reload from the datasource, is that correct?

      I don't know how to create an OnDataBinding event, but i worked around by re-creating header text on sorted event. it works now... thanks again for your help.

      Comment

      Working...