Hyperlink columns in a datagrid control

kristenk

Newcomer
Joined
Mar 3, 2003
Messages
1
I have created a hyperlink column in my datagrid using the property builder of the grid. I have also bound that hyperlink to a field in my dataset. I would like to, based on the user's security, enable the link for some records in my dataset and disable others. How do I do this?
 
KristenK,

Did you ever figure this out? I am need of the same exact thing! Any help would be appreciated!
 
Same problem

CraigB said:
KristenK,

Did you ever figure this out? I am need of the same exact thing! Any help would be appreciated!

I am trying to do the same thing. I am able to disable the column using the itemdatabound event but the link can still be clicked. Any ideas?
 
Disco_gal_1 said:
I am trying to do the same thing. I am able to disable the column using the itemdatabound event but the link can still be clicked. Any ideas?

Visual Basic:
Private Sub DataGrid_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles DataGrid.ItemDataBound
        If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
            If Trim(e.Item.Cells(4).Text) = "P" Then'''''''THis was my condition Use your security condition here
                e.Item.Cells(5).Text = "" ' don't show Data link
            End If
        End If
    End Sub

Replace e.Item.Cells(4) & (5) by appropriate cell numbers


HTH
Ashutosh
 
Back
Top