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

Dsiable Radgrid when Insert template open

1 Answer 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
RB
Top achievements
Rank 1
RB asked on 23 May 2014, 08:37 PM
Can I disable a radgrid when the 'Add new record' template form is open? The user can only view the records. He cant delete or select rows.
This template also has a cancel button, on click of which I want to close the template. How can I achieve this?

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 26 May 2014, 07:24 AM
Hi,

When you disable a RadGrid its entire functionality will be disabled, so what you can do is, cancel the functionalities which you don't want when the Grid is in Insert mode and set them back when the Grid returns to its normal mode as shown below:

C#:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
   //Access the Insert Form
    if (e.Item is GridEditableItem && !e.Item.IsInEditMode && e.Item.OwnerTableView.IsItemInserted)
    {
        GridEditableItem insertItem = (GridEditableItem)e.Item;
        //Access the delete button column
        LinkButton lnkDelete = (LinkButton)insertItem["DeleteButton"].Controls[0];
        lnkDelete.Visible = false;
        //set all properties to false
        RadGrid1.ClientSettings.Selecting.AllowRowSelect = false;
    }
    else
    {
        //Reset the properties
        RadGrid1.ClientSettings.Selecting.AllowRowSelect = true;
    }
}

Thanks,
Princy
Tags
Grid
Asked by
RB
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or