Search code examples
teleriktooltiptelerik-gridtelerik-mvc

Change hover-text of Telerik MVC grid save icon


I have a Telerik MVC (not Kendo) grid that uses the default Ajax binding for editing. For some unfathomable reason, when editing a row, the Save and Cancel buttons sport a tooltip of "Edit". I have not found where to define the Title text for the Save or Cancel buttons, only for the Edit and Delete buttons:

commands.Edit().ButtonType(GridButtonType.BareImage).HtmlAttributes(new { @class = "grid-edit-button" }).ImageHtmlAttributes(new { @alt = "Edit", @title = "Edit" });
commands.Delete().ButtonType(GridButtonType.BareImage).HtmlAttributes(new { @class = "grid-delete-button" }).ImageHtmlAttributes(new { @alt = "Delete", @title = "Delete" });

Incorrect tooltip when mouse is hovering over it

This is code that I copied from another section of the project (unfortunately, written by someone who has since left the company) and it works correctly there. I have had no luck asking Telerik for help, as the MVC libraries are not their most current offerings (but I must use them for legacy reasons).

Does anyone know how to force the tool-tip text to the correct value?


Solution

  • There may be better solutions, but I wound up fixing it through some Javascript trickery (this is what is used by the other instances of this grid. I'd missed it because I had custom edit code for handling the dropdown boxes):

    In the grid definition:

    .ClientEvents(events => events.OnDataBound("defaultGridDataBound").OnEdit("defaultGridEdit"))
    

    And then:

    function defaultGridEdit(e) {
        var $form = $(e.form);
        if (e.mode == "insert") {
            $form.find(".t-grid-insert .t-insert").attr("title", "Save");
            $form.find(".t-grid-insert .t-insert").attr("alt", "Save");
        }
        else {
            $form.find(".t-grid-update .t-update").attr("title", "Save");
            $form.find(".t-grid-update .t-update").attr("alt", "Save");
        }
    
        $form.find(".t-grid-cancel .t-cancel").attr("title", "Cancel");
        $form.find(".t-grid-cancel .t-cancel").attr("alt", "Cancel");
    }