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

[Solved] Grid - GridEditCommandColumn skinning

11 Answers 304 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Maxim Minkov
Top achievements
Rank 1
Maxim Minkov asked on 03 Jun 2009, 12:26 PM
Hi!
Help please, how I can set value for EditImageUrl for GridEditCommandColumn using skin-file?
Here contents of my skin-file for Grid:
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<telerik:RadGrid runat="server"
<MasterTableView 
    CommandItemSettings-AddNewRecordImageUrl="~/Images/add_16.png" 
    CommandItemSettings-RefreshImageUrl="~/Images/refresh_16.png" 
    EditFormSettings-EditColumn-EditImageUrl="~/Images/edit_16.png" 
    EditFormSettings-EditColumn-InsertImageUrl="~/Images/add_16.png" 
    EditFormSettings-EditColumn-UpdateImageUrl="~/Images/save_16.png" 
> 
    <Columns> 
         
    </Columns> 
</MasterTableView> 
</telerik:RadGrid> 

11 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 03 Jun 2009, 02:19 PM
Hello Maxim,

Try setting the EditImageUrl in the skin file as shown below:
.skin:
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
 
 
        <telerik:RadGrid  AutoGenerateColumns="false"  runat="server">       
        <MasterTableView> 
        <Columns> 
        <telerik:GridEditCommandColumn ButtonType="ImageButton" EditImageUrl="~/NewFolder1/rose.jpg"></telerik:GridEditCommandColumn> 
        </Columns> 
        </MasterTableView> 
        </telerik:RadGrid> 

Thanks
Princy.
0
Maxim Minkov
Top achievements
Rank 1
answered on 03 Jun 2009, 06:36 PM
Thanks for the answer.
The given decision does not solve a problem. On the contrary adds a superfluous column in gird and if for example in event ItemDataBound use FindControl method for Item we will receive following exception:
Multiple controls with the same ID 'EditButton' were found. FindControl requires that controls have unique IDs.

I have made the small test project, to load it is possible here (for run just add reference to Telerik.Web.UI.dll).
0
Princy
Top achievements
Rank 2
answered on 04 Jun 2009, 05:40 AM
Hello Maxim,

Try removing the EditCommandColumn markup from the aspx page and set it with the UniqueName only in the skin file as shown below. This should help solve your issue.

.skin:
<Columns> 
    <telerik:GridEditCommandColumn UniqueName="EditCmd"  ButtonType="ImageButton" EditImageUrl="~/Images/edit.png">  
    </telerik:GridEditCommandColumn> 
</Columns> 

Thanks
Princy.
0
Maxim Minkov
Top achievements
Rank 1
answered on 04 Jun 2009, 08:12 AM
Hi Princy,

In the big project with hundreds aspx-files, it to make hard enough.
As in each aspx-file grid has unique UniqueName for EditCommandColumn, and it the name can be used then in .aspx.cs code.As not for all gids in the project it is necessary EditCommandColumn.
0
Sebastian
Telerik team
answered on 09 Jun 2009, 11:28 AM
Hello Maxim,

Here is how you can customize the action images in the grid (should be applicable both for inplace and edit forms editing):

http://www.telerik.com/help/aspnet-ajax/gridcustomizeactionbuttons.html

Note that you can reduce the grid definition and leave only the GridEditCommandColumn and EditFormSettings inside the .skin file to reuse it accross different pages when setting a theme.

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Maxim Minkov
Top achievements
Rank 1
answered on 09 Jun 2009, 12:00 PM
Hello Admin,

sorry but this solution does not help me.
With this .skin file images in EditCommandColumn stay the Telerik default images.
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
<telerik:RadGrid runat="server"
    <MasterTableView 
        CommandItemSettings-AddNewRecordImageUrl="~/Images/add_16.png" 
        CommandItemSettings-RefreshImageUrl="~/Images/refresh_16.png" 
    > 
        <EditFormSettings> 
            <EditColumn 
                EditImageUrl="~/Images/edit_16.png" 
                InsertImageUrl="~/Images/add_16.png" 
                UpdateImageUrl="~/Images/save_16.png" 
            > 
            </EditColumn> 
        </EditFormSettings> 
    </MasterTableView> 
</telerik:RadGrid> 

With your solution - screenshot

If im set EditImageUrl="~/Images/edit_16.png" in EditCommandColumn attributes - screenshot
<telerik:GridEditCommandColumn UniqueName="EditCmd2" ButtonType="ImageButton" EditImageUrl="~/Images/edit_16.png"
                    </telerik:GridEditCommandColumn> 

Thus the question remains opened.
0
Sebastian
Telerik team
answered on 09 Jun 2009, 12:11 PM
Hello Maxim,

As explained in my previous post:

...leave only the GridEditCommandColumn and EditFormSettings inside the .skin file...

Hence in order to change the edit image url for the edit column, you need to include the edit column definition in your skin file, namely:

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>    
<telerik:RadGrid runat="server">    
    <MasterTableView    
        CommandItemSettings-AddNewRecordImageUrl="~/Images/add_16.png"    
        CommandItemSettings-RefreshImageUrl="~/Images/refresh_16.png"    
    >    
        <EditFormSettings>    
            <EditColumn    
                EditImageUrl="~/Images/edit_16.png"    
                InsertImageUrl="~/Images/add_16.png"    
                UpdateImageUrl="~/Images/save_16.png"    
            >    
            </EditColumn>    
        </EditFormSettings>    
    </MasterTableView>  
<Columns>
<telerik:GridEditCommandColumn UniqueName="EditCmd2" ButtonType="ImageButton" EditImageUrl="~/Images/edit_16.png" /
</Columns> 
</telerik:RadGrid>    
 

Thus the column with the custom image should be present in each grid and you can still add more columns to each individual grid instance inside the aspx code of the page.

Regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Maxim Minkov
Top achievements
Rank 1
answered on 09 Jun 2009, 12:31 PM
If I make under your description in everyone grid systems it will be added EditCommandColumn (as you and have described). But that it has earned without errors, I should remove all EditCommandColumns in all grids. But in such decision there is a problem: not in everyone grid in system it is necessary EditCommandColumn.As in everyone existing grids EditCommandColumn can have the own name and if to apply skin, the name will be for all one, thus I will need to change also a code.
0
Accepted
Sebastian
Telerik team
answered on 09 Jun 2009, 12:48 PM
Hello Maxim,

I see your point, however there is no more straight-forward solution than adding this GridEditCommandColumn either in the .skin file (to reuse it across different page) or manually setting it for some of the grid instances in the corresponding aspx pages (where applicable).

Kind regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Maxim Minkov
Top achievements
Rank 1
answered on 09 Jun 2009, 12:56 PM
Hello Admin,

Thanks for answers!Prompt, you can add in the future builds/releases to take out properties concerning graphic registration of grid in separate group (for example as MasterTableView) which as a result could be described in skin for Grid?
0
Sebastian
Telerik team
answered on 09 Jun 2009, 01:07 PM
Hi Maxim,

Thank you for the suggestion - I will forward it to our developers to be considered further. If this appears to be commonly requested possible enhancement, you might see it included in a future version of the product.

Best regards,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Grid
Asked by
Maxim Minkov
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Maxim Minkov
Top achievements
Rank 1
Sebastian
Telerik team
Share this question
or