This is a migrated thread and some comments may be shown as answers.

[Solved] How to remove Edit function based on permissions

2 Answers 244 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Stephen
Top achievements
Rank 1
Stephen asked on 25 Apr 2008, 02:41 PM
Hi,

I am binding RadGrid to an ObjectDataSource.  I have a table in the database which controls who can make edits in the data (rather than using SQL security and pass though authentication).

How can I remove the Edit button based on some logic - which event do I have to capture.

Imagine I have a function called CheckAccess which returns true or false....

PseudoCode

Before DataGrid Renders
    Is CheckAccess returning False Then
        Hide Edit Buttons and Edit Columns
    Else
        Show Edit Buttons and Edit Columns

Thanks

2 Answers, 1 is accepted

Sort by
0
Vladimir
Top achievements
Rank 1
answered on 26 Apr 2008, 07:24 AM
Hi Stephen,

You can use ItemCreated to achieve this. Here is an example:

If TypeOf e.Item Is GridDataItem Then
  Dim editButton As LinkButton = CType(CType(e.Item, GridDataItem)("YourEditColumnUniqueName").Controls(0), LinkButton)
  editButton.Visible = your condition
End If
0
Princy
Top achievements
Rank 2
answered on 28 Apr 2008, 06:24 AM
Hi,

You can also check out the demo link below on how to access controls in the cells.

Accessing Cells and Rows


Thanks,
Princy


Tags
Grid
Asked by
Stephen
Top achievements
Rank 1
Answers by
Vladimir
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or