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

[Solved] Select-Buttons enabled depending on user permissions?

2 Answers 135 Views
Grid
This is a migrated thread and some comments may be shown as answers.
scrut
Top achievements
Rank 1
scrut asked on 09 May 2008, 12:10 PM
In my application, I need several tables showing a summary of data items.
Depending on the user's permissions, he should be able to VIEW, EDIT, or DELETE the associated data item.

Since the table is just a summary and the real records the grid items represent are spread over 20+ tables, I don't think I can use the built-in edit function. (Q1: is that correct? I have a DataSet providing the summary data and I also have a set of stored procedures performing the rather complex update- and delete-operations)

So I thought to give my grid 3 columns with Select buttons called View, Edit, Delete.

I assumed I'd be able to use the respective event handler to then simply call the appropriate stored procedures depending on which button the user clicked.

But these View, Edit, Delete buttons are not to be enabled at all times: depending on the users permissions, I want to e.g. disable the delete button on certain rows.

How do I do that?

Thanks so much!

s.


P.S. I am new to ASP & Prometheus - so I hope you can forgive me for asking basic questions.

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 10 May 2008, 04:14 PM
Hi scrut,

You can use ItemCreated event to get reference to desired button and apply desired properties. Here is an example:

<telerik:GridButtonColumn CommandName="Select" Text="Select" UniqueName="MyColumn" />
...

if(e.Item is GridDataItem)
{
    LinkButton LinkButton1 = (LinkButton)((GridDataItem)e.Item)["MyColumn"].Controls[0];
    ...
}

All the best,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Vlad
Telerik team
answered on 10 May 2008, 04:17 PM
Hello scrut,

Just a quick follow up about the editing.

You can use manual updates/deletes similar to this example where the grid will extract only new/needed values and you can perform desired operations:
http://www.telerik.com/community/code-library/submission/b311D-mmdbh.aspx

All the best,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
Tags
Grid
Asked by
scrut
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Share this question
or