DataGrid Column Style and Hyperlink questions

  • Thread starter Thread starter Cezar
  • Start date Start date
C

Cezar

Hello,

Is it possible to create a special style just for one column of the grid.
I want to display in Bold the values of a column.

Also, for a column, I want to create hyperlinks only for some values,
based on a condition :
e.g
public void OnItemDataBoundEventHandler(Object sender, DataGridItemEventArgs e)
{
TableCell linkNameCell;

if(condition)
{
//NO LINK
}
else
{
linkNameCell = (TableCell) e.Item.Cells[4];
hName.NavigateUrl = "someURL";
}

I know I can always make a "#" link but it would ne nicer if I could just
have no link at all,

Thank you,
Cezar
 
1. Instead of using a hyperlink control, use a label control.
2. Create a css class that makes a label looks like a hyperlink. Let's
name it "LooksLikeALink"
3. In your OnItemDataBoundEventHandler, for the item that you want to
make it a hyperlink, set the label to use the "LooksLikeALink" css
class. Also, set the "onclick" event to call a piece of javascript
that will redirect you to the target page. Such as "window.location =
'someOtherPage.aspx'.

Tommy,
 
Back
Top