DataGrid Column Style and Hyperlink questions

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

  1. Cezar

    Cezar Guest

    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
     
    Cezar, Nov 26, 2003
    #1
    1. Advertising

  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 =
    'someOtherPage.aspx'.

    Tommy,

    "Cezar" <> wrote in message news:<>...
    > 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
     
    Tommy, Nov 27, 2003
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?V2FyYW4=?=

    HyperLink Column and Button Column in a DataGrid

    =?Utf-8?B?V2FyYW4=?=, Aug 9, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    627
    =?Utf-8?B?V2FyYW4=?=
    Aug 9, 2005
  2. Replies:
    0
    Views:
    2,514
  3. =?Utf-8?B?ZGF2aWQ=?=
    Replies:
    11
    Views:
    1,028
    deandany
    Jul 17, 2006
  4. davetichenor
    Replies:
    1
    Views:
    914
    Eliyahu Goldin
    Oct 30, 2006
  5. Dave
    Replies:
    0
    Views:
    1,002
Loading...

Share This Page