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

Localizing Radgrid Grouppanel Text

6 Answers 101 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Atin
Top achievements
Rank 1
Atin asked on 16 Jun 2012, 06:04 AM
Hi All,

I am trying to create a new control by inheriting Radgrid control. I am trying to localize the text "Drag and Drop a column here to group by that column". I created a customlocalizer class to localize and have overriden the base calss method "GetStringOverRide" to override the property "GridviewGroupPanelText" as suggested in the localization documentation on telerik blogs.

The problem is i do not know when to call the below code

LocalizationManager.Manager = new CustomLocalizationManager();


to initialize the localization before UI initialization. Is there some event provided by the radgrid that i can use to initialize the localization. I tried to override the onApplyTemplate but that removes everything else (styling and data).

Any help will be greatly appreciated.

Thanks,
Atin

6 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 18 Jun 2012, 06:02 AM
Hello,

 You may assign the custom localization manager to the grid once the page is loaded. Please take a look at this forum thread for a reference.

I hope this is helpful. 

All the best,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Atin
Top achievements
Rank 1
answered on 18 Jun 2012, 06:31 AM
Hi Didie,

Thanks for the information.

However, my problem is a little bit different than the suggested answer. I am creating a custom control by inheriting radgrid. I want to do the localization of the text in the custom control itself (because this is being used many times) so that i donot have to write the localization code in the pages repeatedly. Does radgrid contain any event that can be used to fire the localization whenever control is loaded or before loading.

Regards,
Atin
0
Dimitrina
Telerik team
answered on 18 Jun 2012, 06:34 AM
Hi,

 In your case then, you could use the DataLoading event of the RadGridView to assign the localization manager.

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Atin
Top achievements
Rank 1
answered on 18 Jun 2012, 07:08 AM
Hi Didie,

I tried your suggestion, but no luck. Here is sample code that i am using. I have removed project specific code.

using System;
  
using System.Collections.Generic;
  
using System.Collections.Specialized;
  
using System.ComponentModel;
  
using System.ComponentModel.Composition;
  
using System.Linq;
  
using System.Windows;
  
namespace MyNameSpace
  
{
  
public class MycustomControl : RadGridView, INotifyPropertyChanged
  
{
  
  
#region Public 
  
public MycustomControl()
  
{
  
if (!System.ComponentModel.DesignerProperties.IsInDesignTool)
  
{
  
CompositionInitializer.SatisfyImports(this);
  
this.DataLoading += new EventHandler<GridViewDataLoadingEventArgs>(MyCustomControl_DataLoading);
  
ShowGroupPanel = false; // This property is set to true on the page where this control is placed.
  
}
  
}
  
void MyCustomControl_DataLoading(object sender, GridViewDataLoadingEventArgs e)
  
{
  
LocalizationManager.Manager = new CustomLocalizationManager();
  
}
  
#endregion 
  
}
  
public class CustomLocalizationManager : LocalizationManager
  
  
public override string GetStringOverride(string key)
  
{
  
System.Diagnostics.Debugger.Break();
  
switch (key)
  
{
  
case "GridViewGroupPanelText":
  
return "Sample text goes here";
  
}
  
return base.GetStringOverride(key);
  
}
  
}
  
}


Please let me know if there is some other way to do this.

Regards,
Atin
0
Dimitrina
Telerik team
answered on 19 Jun 2012, 01:02 PM
Hi,

 I have tried to test how your code snippet works but I was not able to build the project. That is why I have tested the code using our RadGridView instead of your MycustomControl. As a result the localization text was applied fine. 
I noticed that you have ShowGroupPanel = false; Would you please let me know what the result is if you comment this line?

Greetings,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
Atin
Top achievements
Rank 1
answered on 20 Jun 2012, 03:59 AM
Hi Didie,

Thanks for the updates.

I just realised the code is working fine. Actually we were applying themes on the gridview, so it was overridding the localization as we had also applied the localization in the themes.

Regards,
Atin
Tags
GridView
Asked by
Atin
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Atin
Top achievements
Rank 1
Share this question
or