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

Reposition Insert/Update/Cancel Buttons

3 Answers 129 Views
Grid
This is a migrated thread and some comments may be shown as answers.
alo
Top achievements
Rank 1
alo asked on 18 Mar 2009, 10:42 PM
I have a GridEditCommandColumn defined in the first column of my grid.  This results in the Insert/Cancel buttons and the Update/Cancel buttons being placed on the left hand side of the grid's insert and edit forms.  Is it possible to move these buttons to the right hand side of the insert and edit forms?

Thanks,

Al

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 19 Mar 2009, 04:08 AM
Hello Al,

You can access the buttons and set their margins in CssClasses as shown below:
cs:
 protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
       if ((e.Item is GridEditableItem) && (!e.Item.OwnerTableView.IsItemInserted) && (e.Item.IsInEditMode)) 
        { 
            GridEditFormItem editItem = (GridEditFormItem)e.Item; 
            LinkButton linkBtn = (LinkButton)editItem.FindControl("UpdateButton");             
            linkBtn.CssClass = "Button"
        } 
 
        if (e.Item is GridEditFormInsertItem && e.Item.OwnerTableView.IsItemInserted) 
        { 
            GridEditFormInsertItem insertItem = (GridEditFormInsertItem)e.Item; 
            LinkButton linkBtn1 = (LinkButton)insertItem.FindControl("PerformInsertButton"); 
            linkBtn1.CssClass = "Button"
        } 
    } 

css:
<style type="text/css"
    .Button 
    { 
      margin-left:800px
       
    } 
    
</style> 

Thanks,
Princy.
0
alo
Top achievements
Rank 1
answered on 19 Mar 2009, 08:08 PM
Princy,

I modified your code as follows because I'm using the image buttons instead of the link buttons.  Also, I had to change the second if statement to test for a GridDataInsertItem instead of the GridEditFormInsertItem.

        if ((e.Item is GridEditableItem) && (!e.Item.OwnerTableView.IsItemInserted) && (e.Item.IsInEditMode))  
        {  
            GridEditableItem editItem = (GridEditableItem)e.Item;  
            ImageButton imageButton = (ImageButton)editItem.FindControl("UpdateButton");  
            imageButton.CssClass = "Button";  
        }  
 
        if (e.Item is GridDataInsertItem && e.Item.OwnerTableView.IsItemInserted)  
        {  
            GridDataInsertItem editItem = (GridDataInsertItem)e.Item;  
            ImageButton imageButton = (ImageButton)editItem.FindControl("PerformInsertButton");  
            imageButton.CssClass = "Button";  
        }  

It now picks up the style, but it is also shifting ALL the other controls over to the right.  I just need to move the image buttons.  It seems like I need to resequence the controls.  Any ideas how to do that? 

Thanks,

Al
0
Yavor
Telerik team
answered on 23 Mar 2009, 11:27 AM
Hello Al,

Another possible option in this case would be to use a custom edit form, for example a template form. This would give you a much better chance to position the elements.
I hope this helps.

All the best,
Yavor
the Telerik team

Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
alo
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
alo
Top achievements
Rank 1
Yavor
Telerik team
Share this question
or