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

Closing edit mode on second click

2 Answers 109 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sagi
Top achievements
Rank 1
Sagi asked on 22 Jul 2011, 12:34 AM
Hi,

Is it possible that the EDIT button would change to CLOSE button when a row is in edit mode?
This would make the closing of an edited row much faster instead of going to the bottom and clicking the CANCEL button.

Thanks

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 22 Jul 2011, 07:17 AM
Hello Sagi,

You can try the following code snippet in ItemCreated event to access the Edit button in Edit mode and then change it to close button.

C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
        {
            GridEditFormItem item = (GridEditFormItem)e.Item;
            LinkButton link = (LinkButton)e.Item.FindControl("CancelButton");
            link.Visible = false;
            LinkButton btn = (LinkButton)item["AutoGeneratedEditColumn"].Controls[0];
            btn.CommandName = "Cancel";
            btn.Text = "Close";
        }
}

Thanks,
Princy.
0
Sagi
Top achievements
Rank 1
answered on 22 Jul 2011, 10:11 AM
Great princy! Worked like a charm and looks much nicer now :)
Tags
Grid
Asked by
Sagi
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Sagi
Top achievements
Rank 1
Share this question
or