Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
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?
  • 5 months later...
  • 2 years later...
Posted

Same problem

 

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?

Posted
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?

 

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...