DataGrid Column Style and Hyperlink questions

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
 
T

Tommy

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,
 

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

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top