How to specify ROW properties in a datagrid

J

Jørn A

Customizing a datagrid is as you probably all know done by defining the
different columns.
But is it possible to specify properties for the ROWS in the datagrid?
I would like to make a hyperlink that spans each complete row in the grid.
I would also like to define a CSSClass for the TR HTML-tags written by the
datagrid.
Can this be done?

-Jørn A.
 
A

Amar

You Should override OnItemCreated

protected override void OnItemCreated(DataGridItemEventArgs e) {
if (e.Item.ItemType == ListItemType.Item ||
e.Item.ItemType == ListItemType.AlternatingItem){
e.Item.Attributes["class"] = "TRClass"; (Your Class Name)
}
}

by the same way you can add any javascript code you want at each row,
by using Atrtibutes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top