Datagrid

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • altaafhussein
    New Member
    • Jul 2009
    • 9

    Datagrid

    Hi, I have a datagrid pulling data from a database and displaying it. I need to be able to highlight a row when a row is selected. I have looked over the internet and found using a checkbox is best. However the users don't want this as it is not intuative enough. They want to click anywhere in the row, and highlight it like you would in a windows based system.

    I have added the following code in the item created event

    e.Item.Attribut es.Add("onclick ", "this.style.bac kgroundColor='' Green")

    however i need some way of deselecting this when they click on another row.

    any help would be appretiated

    thanks altaafhussein
  • MrMancunian
    Recognized Expert Contributor
    • Jul 2008
    • 569

    #2
    As you didn't mention anything about the environment you use, I'll just presume you use Visual Studio... Set the SelectionMode for the Datagrid on FullRowSelect and select the color in the RowsDefaultCell Style and the AlternatingRows DefaultCellStyl e.

    Steven

    Comment

    Working...