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

Best way to control Grid CRUD behavior

1 Answer 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
AkAlan
Top achievements
Rank 2
AkAlan asked on 19 Apr 2011, 10:50 PM
What is the best way to control a RadGrids CRUD behavior depending on the users Role? I already have a grid built with all of the updating and deleting functionality built in. Now I want to allow only certain users the ability to update and delete.
 


1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 20 Apr 2011, 08:27 AM
Hello AkAlan,

You can set the visibility of the buttons( Edit,Delete) based on the user roles in the ItemDataBoud Event like below.

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
   {
       if (e.Item is GridDataItem)
       {
           GridDataItem item=(GridDataItem)e.Item;
           if(item["UserRile"].Text=="User1")
           {
               e.Item.FindControl("EditButton").Visible = false;//Using EditCommandColumn.
           }
       }
    }

Thanks,
Shinu.
Tags
Grid
Asked by
AkAlan
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or