Grid enable insert/update/delete according to user

3 posts, 1 answers
  1. Suzy
    Suzy avatar
    66 posts
    Member since:
    Nov 2014

    Posted 15 Apr 2015 Link to this post


    I have a radgrid with insert/update/delete function available (NOT automatic but manual).  Behind my tool there is a user database with security settings.  I need to set the insert/update/delete function unavailable for the users that have no rights to do this and for the user who have right to do this the insert/update/delete function must be availabe.

    My question is how do I make the functions unavailable? How can I do this in code behind?

    Please advice.

    Kind regards


  2. Answer
    Jayesh Goyani
    Jayesh Goyani avatar
    2732 posts
    Member since:
    May 2010

    Posted 15 Apr 2015 in reply to Suzy Link to this post


     Please try with the below code snippet.

    <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" OnNeedDataSource="RadGrid1_NeedDataSource">
                  <MasterTableView CommandItemDisplay="Top">
                          <telerik:GridBoundColumn DataField="Name" UniqueName="Name" HeaderText="Name"></telerik:GridBoundColumn>
                          <telerik:GridEditCommandColumn UniqueName="EditColumn"></telerik:GridEditCommandColumn>
                          <telerik:GridButtonColumn ButtonType="PushButton" CommandName="Delete" UniqueName="DeleteColumn" Text="Delete"></telerik:GridButtonColumn>


    protected void Page_Load(object sender, EventArgs e)
        //Hide add new button
        RadGrid1.MasterTableView.CommandItemSettings.ShowAddNewRecordButton = false;
        //hide edit column
        RadGrid1.Columns.FindByUniqueName("EditColumn").Visible = false;
        //hide delete column
        RadGrid1.Columns.FindByUniqueName("DeleteColumn").Visible = false;
    protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
        dynamic data = new[] {
            new { ID = 1, Name ="Name1"},
            new { ID = 2, Name ="Name2"}
        RadGrid1.DataSource = data;


    Let me know if any concern. 


    Jayesh Goyani

  3. DevCraft R3 2016 release webinar banner
  4. Suzy
    Suzy avatar
    66 posts
    Member since:
    Nov 2014

    Posted 16 Apr 2015 in reply to Jayesh Goyani Link to this post


    That was what I needed :-)

Back to Top