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

Change icon for GridEditCommandColumn for edited item only

2 Answers 529 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shira
Top achievements
Rank 1
Shira asked on 02 Jun 2011, 12:17 AM
I have a radgrid with an editform  defined in a FormTemplate.  When the editform opens below the grid row based on the user clicking the Edit icon in that grid row, it would be nice to then change the icon just clicked to a cancel icon (the user is now in edit mode - why show edit icon), but ONLY for the item being edited - the other items should still have edit icons.  Is this possible in a RadGrid?  The edit icon is defined in a GridEditCommandColumn. Thanks!

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 02 Jun 2011, 10:45 AM
Hello Shira,

Try the following approach to achieve your requirement.
C#:
protected void RadGrid2_ItemCreated(object sender, GridItemEventArgs e)
  {
 if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
        {
            GridEditFormItem item = (GridEditFormItem)e.Item;
            item["ColumnUniqueName"].Controls.Clear();
            ImageButton img1 = new ImageButton();
            img1.ImageUrl = "~/images/CancelBtn.bmp";
            img1.CommandName = "Cancel";
            item["ColumnUniqueName"].Controls.Add(img1);
        }
    }

Thanks,
Shinu.
0
Shira
Top achievements
Rank 1
answered on 03 Jun 2011, 09:35 PM
Thanks Shinu.  That did change the icon, but did not change the functionality of the icon to make it save instead of delete.  How can I change the command associated with the GridEditCommandColumn for that one row that's being edited? 

(FYI, I suspect the answer *may* be similar to the one to the other post I have up, http://www.telerik.com/community/forums/aspnet-ajax/grid/change-gridclientdeletecolumn-confirmtext-in-codebehind.aspx, as in both cases the issue is how to change one of the attributes of a RadGrid command column, though in this case I want to change for just one row, an in that case I need to change all rows)

Thanks!
Tags
Grid
Asked by
Shira
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Shira
Top achievements
Rank 1
Share this question
or