DataGrid Column Style and Hyperlink questions

Discussion in 'ASP .Net' started by Cezar, Nov 26, 2003.

  1. Cezar

    Cezar Guest


    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 :
    public void OnItemDataBoundEventHandler(Object sender, DataGridItemEventArgs e)
    TableCell linkNameCell;

    //NO LINK
    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, Nov 26, 2003
    1. Advertisements

  2. Cezar

    Tommy Guest

    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 =

    Tommy, Nov 27, 2003
    1. Advertisements

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 (here). After that, you can post your question and our members will help you out.