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

How to rename default Grid labels

2 Answers 110 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Anoop
Top achievements
Rank 1
Anoop asked on 03 Jan 2013, 06:29 PM
I want to rename "Drag a column here to group by this column","Click here to add a new row"
Is it possible ?

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 07 Jan 2013, 08:00 AM
Hi,

Try the following code snippet to achieve your scenario.

C#:
this.radGridView1.TableElement.GridViewElement.GroupPanelElement.Text = "add a new row";

Thanks,
Shinu.
0
Anton
Telerik team
answered on 08 Jan 2013, 09:31 AM
Hello guys,

There are two approaches to achieve the desired behavior in this case:

1.To set the text of the elements like Shinu already showed. Also you can read more about this approach in the following forum thread: http://www.telerik.com/community/forums/winforms/gridview/radgridlocalizationprovider-custom-groupingpaneldefaultmessage.aspx

2. Or to use custom grid localization provider that inherits RadGridLocalizationProvider. For example:
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }
 
    private void Form1_Load(object sender, EventArgs e)
    {
        DataTable listTable = new DataTable();
        listTable.Columns.Add("Name");
        listTable.Columns.Add("Busy");
        listTable.Columns.Add("Id");
 
        listTable.Rows.Add("Saraha", "No", 1);
        listTable.Rows.Add("Joe", "No", 2);
        listTable.Rows.Add("Lisa", "Yes", 3);
        listTable.Rows.Add("George", "No", 4);
        listTable.Rows.Add("Mary", "Yes", 5);
        listTable.Rows.Add("Janet", "No", 6);
 
        this.radGridView1.DataSource = listTable;
 
        RadGridLocalizationProvider.CurrentProvider = new CustomLocalizationProvider();
    }      
}
 
public class CustomLocalizationProvider : RadGridLocalizationProvider
{
    public override string GetLocalizedString(string id)
    {
        switch (id)
        {
            case RadGridStringId.AddNewRowString:
                return "Your Add new Row Text";
            case RadGridStringId.GroupingPanelDefaultMessage:
                return "Your Grouping Panel Default Message Text";
        }
 
        return base.GetLocalizedString(id);
    }
}
 
I hope this helps. Do not hesitate to write back if you have further questions.

Greetings,
Anton
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
Tags
GridView
Asked by
Anoop
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Anton
Telerik team
Share this question
or