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

AddRow text

7 Answers 260 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Pierre
Top achievements
Rank 2
Iron
Iron
Pierre asked on 28 Jan 2008, 05:21 PM
Hi, it is possible to change the default "Click here to add a new row" ? I need to support french language to. I can't foun a property to change the default text programmatically.

Thanks

7 Answers, 1 is accepted

Sort by
0
Accepted
Jack
Telerik team
answered on 29 Jan 2008, 01:00 PM
Hi Pierre,

Thank you for this question.

Yes, it is possible to change the "Add new row" text in RadGridView. You merely need to set the AddNewRowMessageString property of the LocalisationSettings property of the RadGridView.

Let us know if you have other questions.

Kind regards,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Mike
Top achievements
Rank 1
answered on 27 May 2008, 08:06 PM
I have the same question  as Pierre. I want to change the add row text. I followed the suggestion from Jack and set the LocalizationSettings/AddNewRowMessageString to simply "Add New Row...". When i run the form, the gridview add row still has the default text.

i am using Q1 2008.

any help is appreciated.
0
Jack
Telerik team
answered on 28 May 2008, 12:32 PM
Hi Mike,

Thank you for this question.

In Q1 2008, we introduced a new localization system in RadGridView. Now you are able to customize all strings in the grid using the RadGridLocalizationProvider class. There is a localization example under the RadGridView branch in the Examples application that comes included with our product.

Consider the following code snippet:

class MyLocalizationProvider: RadGridLocalizationProvider 
    public override string GetLocalizedString(string id) 
    { 
        if (id == RadGridStringId.AddNewRowString) 
        { 
            return "My custom add new row string goes here."
        } 
 
        return base.GetLocalizedString(id); 
    } 
 
RadGridLocalizationProvider.CurrentProvider = new MyLocalizationProvider(); 
 

I hope this helps. Let me know if you have other questions.

Kind regards,
Jack
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
John Hughes
Top achievements
Rank 1
answered on 07 May 2010, 01:04 AM
Is it possible to have a different AddNewRowString for different levels of hierarchy?  See my example below.

* Click here to add a new Job
+ Job1
+ Job2
-  Job3
    * Click here to add a new contractor                     
    + Contractor1
    + Contractor2


Thanks,


John
0
Jack
Telerik team
answered on 10 May 2010, 04:08 PM
Hello Mike,

You can handle the ViewRowFormatting event to solve this issue. Please consider the code snippet below:

void radGridView1_ViewRowFormatting(object sender, RowFormattingEventArgs e)
{
    GridViewNewRowInfo newRowInfo = e.RowElement.RowInfo as GridViewNewRowInfo;
    if (newRowInfo != null)
    {
        if (newRowInfo.DataRowInfo != null || e.RowElement.Children[1].Visibility == ElementVisibility.Visible)
        {
            e.RowElement.Text = "";
        }
        else if (newRowInfo.ViewInfo.ParentRow != null)
        {
            e.RowElement.Text = "Click here to add a new contractor";
        }
        else
        {
            e.RowElement.Text = "Click here to add a new Job";
        }
    }
}

I hope this helps.

Kind regards,
Jack
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
John Hughes
Top achievements
Rank 1
answered on 11 May 2010, 01:23 AM
Thanks Jack.  This code solves my problem......almost.  What is happening now is that after I click on Add Contractor and get a new row, the text Add Contractor is written over the top of the cells in the row.  This makes it hard to tell what you are looking at in the row.  Once you are done with the row and add another one, then the text is not written there any more, but it does show up on the "new" row.  I have changed the AddNewRowPosition to PinnedRowPosition.Bottom.   Would that be causing this problem?

Any thoughts or suggestions would be appreciated.

Thanks,

John
0
Jack
Telerik team
answered on 13 May 2010, 05:54 PM
Hi John,

Despite my efforts, I was not able to reproduce the issue. Could you please send me your project? I will investigate the issue further and will try to find the best option for you. I am looking forward to your reply.

Please note that you have to open a new support ticket in order to attach your project.

Sincerely yours,
Jack
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.
Tags
GridView
Asked by
Pierre
Top achievements
Rank 2
Iron
Iron
Answers by
Jack
Telerik team
Mike
Top achievements
Rank 1
John Hughes
Top achievements
Rank 1
Share this question
or