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

Grid insert button text

13 Answers 369 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mark Shortt
Top achievements
Rank 1
Mark Shortt asked on 23 May 2011, 02:52 PM
Hi

Can you tell me how to change the text of the insert button on the grid? I have tried using the Custom Command  method but that calls the method outside of the grid, instead of entering the new record within the grid

Thanks

Mark

13 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 23 May 2011, 04:58 PM
Hi Mark Shortt,

 The only way to customize the Insert button text is by tweaking the grid localization.

Kind regards,
Atanas Korchev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Mark Shortt
Top achievements
Rank 1
answered on 23 May 2011, 05:02 PM
ok, thanks
0
Joe
Top achievements
Rank 1
answered on 23 Jun 2011, 10:19 PM
Is there any way to customize the text for a grid on a specific page without changing it site-wide?
0
Dimo
Telerik team
answered on 24 Jun 2011, 06:00 AM
Hi Joe,

You can use a Grid localization file on a specific page by setting Culture and UICulture only on that page.

http://www.telerik.com/help/aspnet-mvc/telerik-ui-components-grid-localization.html

This approach is actually used in our online demos where the localization capabilities of the components are demonstrated on specific pages only.

Best wishes,
Dimo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Joe
Top achievements
Rank 1
answered on 24 Jun 2011, 03:13 PM
Worked, thanks.
0
Aaron
Top achievements
Rank 1
answered on 25 Jul 2011, 02:02 PM
Personally, I wouldn't use the UICulture hack; this could have unintended side-effects and is extremely cumbersome if you're doing a lot of customization.

A faster way on single-language sites is to use a single line of jQuery:

$("#Widgets .t-grid-add").first().text("Add new widget");

You can even use this for master-detail grids, if the detail insert should have a different title (which is impossible to do by playing with culture settings alone). Example markup:

@(Html.Telerik().Grid<Widget>()
    .Name("Widgets")
    ...
    .DetailView(v => v.ClientTemplate(
        Html.Telerik().Grid<Part>()
            .Name("WidgetParts_<#=Id#>")
            ...
            .ToolBar(b => b.Insert())
            .ClientEvents(e => e.OnLoad("partsGrid_OnLoad"))
            .ToHtmlString())))

and the corresponding script:

function partsGrid_OnLoad(e) {
    $(this).find(".t-grid-add").first().text("Add part");
}

Very easy.  And if you really need i18n then you can insert a code nugget into the text() parameter which looks up a localization string.
0
Mark Freedman
Top achievements
Rank 1
answered on 28 Jul 2011, 10:17 PM
Great solution. One thing I would add, in case you're using GridButtonType.ImageAndText:

$("#Widgets .t-grid-add").first().text("Add new widget").prepend("<span class='t-icon t-add'>");

Otherwise, you'll lose the icon altogether.


0
Robert
Top achievements
Rank 1
answered on 19 Apr 2012, 06:02 PM
Nevermind.
0
Matthew
Top achievements
Rank 1
answered on 14 May 2012, 05:36 PM
Mark, your answer is the best from what I can tell, but you need to change it from 

$("#Widgets .t-grid-add").first().text("Add new widget").prepend("<span class='t-icon t-add'>");

 to

$("#Widgets .t-grid-add").first().text("Add new widget").prepend("<span class='t-icon t-add' />");

Notice the closing '/' at the end of the span tag.
0
Mark Freedman
Top achievements
Rank 1
answered on 14 May 2012, 06:54 PM
Thanks, Matthew. Good catch.
0
Chillax
Top achievements
Rank 1
answered on 21 Jun 2012, 10:50 AM
Hi Everyone

I want to add a new button in telerik MVC grid in the following sequence.
Edit,MY Custom Button,Delete
Please see the image below that will clear what i want. After adding this button i want to show a popup but that's task will be done later.

Image Link : http://i.imgur.com/aS5lQ.jpg

Kind Regards
0
Matthew
Top achievements
Rank 1
answered on 25 Jun 2012, 06:38 PM
0
Nancy
Top achievements
Rank 1
answered on 29 Aug 2012, 05:39 PM
How to change the text of Edit button . I m using  2010.3.1318
Tags
Grid
Asked by
Mark Shortt
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
Mark Shortt
Top achievements
Rank 1
Joe
Top achievements
Rank 1
Dimo
Telerik team
Aaron
Top achievements
Rank 1
Mark Freedman
Top achievements
Rank 1
Robert
Top achievements
Rank 1
Matthew
Top achievements
Rank 1
Chillax
Top achievements
Rank 1
Nancy
Top achievements
Rank 1
Share this question
or