Wednesday, July 4, 2012

How to add a custom button in Telerik MVC Grid Column with Edit and delete Button

Telerik MVC Razor Code :
columns.Command(commands =>
{
commands.Edit().ButtonType(GridButtonType.Image);                                    commands.Custom("myButtonName").ButtonType(GridButtonType.Image).Action("myAction","myController").Ajax(true);
commands.Delete().ButtonType(GridButtonType.Image);
});



Javascript Code :
You can also assign a custom style to the button by using client side event onRowDataBound. Here is the code.

function onRowDataBound(e) {

var del = $(e.row).find($('.t-icon.t-ProcessPayment'));
        del.css('background-image', 'url("/Content/Images/SettingsBG.png")');
        del.css('background-repeat', 'no-repeat;');
        del.css('background-position-x', 0);
        del.css('background-position-y', 0);
}


                                                               


No comments:

Post a Comment