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

Accessing telerik generated resx file from code behind

1 Answer 212 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Michael
Top achievements
Rank 1
Michael asked on 27 Jul 2012, 11:56 AM
I came across an issue when exporting to CSV that the headings where coming out as the name of the text box but i fixed this by adding code after the InitializeComponent() for the report e.g. this.textBox5.Name = "Description"; I want to be able to set this value as the localized value so how do i access the resx files that are generated for me? They aren't in my standard local or global localization folders so i do not know how to access them programmatically.
Michael

1 Answer, 1 is accepted

Sort by
0
IvanY
Telerik team
answered on 01 Aug 2012, 08:48 AM
Hello Michael,

Accessing resx files is fairly easy as you can always create a ResourceManager that is capable of delivering the objects located in the resource file. This is how you can do it:

var ResourceManager = new System.Resources.ResourceManager("MyNamespace.MyReport", typeof(MyReport).Assembly);
var myString = ResourceManager.GetString("checkBox1.Text");

The GetString method also supports cultures, for more information please check this MSDN article.

Please note that you can rename your text boxes using the property panel in design time - you do not need to rename them at runtime. Please also have in mind that if you are trying to localize the strings in your report there are better ways - check our Localizing Reports help article.

Regards,
IvanY
the Telerik team

BLOGGERS WANTED! Write a review about Telerik Reporting or the new Report Designer, post it on your blog and get a complimentary license for Telerik Reporting. We’ll even promote your blog and help bring you a few fresh readers. Yes, it’s that simple. And it’s free. Get started today >

Tags
General Discussions
Asked by
Michael
Top achievements
Rank 1
Answers by
IvanY
Telerik team
Share this question
or