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

Insert, cancel as icons in "InPlace" edit mode

1 Answer 152 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mahesh Ramakrishnan
Top achievements
Rank 1
Mahesh Ramakrishnan asked on 31 Jul 2008, 06:55 PM
I havea simple grid with AutoGenerated Edit and Delete columns. And default CommandItem "Add New" command with EditMode set to "In Place".

When in Edit mode, the "Insert" (or "Update") and "Cancel" come as LinkButtons occupying only the "Edit" column. As this column is not big enough to hold the two LinkButtons, I tried to do

1. replace these with ImageButtons.
or
2. make these two buttons occupy both "Delete" and "Edit" columns.

The only problem I try to solve is to fit the Insert( or Update) and Cancel into the grid without doubling the "Edit" column width. I am wondering if there is a way to achieve this.

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 01 Aug 2008, 05:37 AM
Hello Mahesh,

To replace the Update and Cancel buttons (in EditMode) with Image buttons you can try out the following code.

cs:
 protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridEditableItem && e.Item.IsInEditMode) 
        { 
            GridEditableItem item = (GridEditableItem)e.Item; 
            item["EditColumn"].Controls.Clear(); 
            ImageButton img1 = new ImageButton(); 
            img1.ImageUrl = "~/images/New Bitmap Image.bmp"
            img1.CommandName = "Cancel"
            item["EditColumn"].Controls.Add(img1);            
        } 
          
    } 

However if you want the buttons to fit in the Edit column, you can set the TableLayout property of the RadGrid to Auto.

Thanks
Princy.
Tags
Grid
Asked by
Mahesh Ramakrishnan
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or