Accentuated characters on a Custom Control
Greetings,
<%@ Control Language="C#"%>
<%@ Register Assembly="Telerik.Sitefinity" Namespace="Telerik.Sitefinity.Web.UI" TagPrefix="sitefinity" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" %>
<
sitefinity:ResourceLinks
ID
=
"resourcesLinks"
runat
=
"server"
UseEmbeddedThemes
=
"True"
>
<
sitefinity:ResourceFile
AssemblyInfo
=
"Controls.Test.Test, Controls"
Name
=
"Controls.Test.Resources.Test.css"
Static
=
"true"
/>
</
sitefinity:ResourceLinks
>
Normal Text: ãâáàº
<
br
/>
ASPTextBox (Text="ãâáàº" applied on the .ASCX): <
asp:TextBox
ID
=
"TextBox1"
runat
=
"server"
Text
=
"ãâáàº"
/>
<
br
/>
RadTextBox (Text="ãâáàº" applied on the .ASCX): <
telerik:RadTextBox
ID
=
"RadTextBox1"
runat
=
"server"
Text
=
"ãâáàº"
/>
<
br
/>
ASPTextBox (Text="ãâáàº" applied on the .CS): <
asp:TextBox
ID
=
"TextBox2"
runat
=
"server"
/>
<
br
/>
RadTextBox (Text="ãâáàº" applied on the .CS): <
telerik:RadTextBox
ID
=
"RadTextBox2"
runat
=
"server"
/>
using System.Web.UI.WebControls;
using Telerik.Sitefinity.Web.UI;
using Telerik.Sitefinity.Web.UI.ControlDesign;
using Telerik.Sitefinity.Modules.Pages.Web.UI;
using Telerik.Web.UI;
namespace Controls.Test
[RequireScriptManager]
[ControlDesigner(typeof(TestDesigner))]
public class Test : CustomSimpleView
protected override void InitializeControls(GenericContainer controlContainer)
TextBox2.Text = "ãâáàº";
RadTextBox2.Text = "ãâáàº";
protected override string LayoutTemplateName
get return "Controls.Test.Views.Test.ascx";
protected virtual TextBox TextBox2
get return base.Container.GetControl<
TextBox
>("TextBox2", true);
protected virtual RadTextBox RadTextBox2
get return base.Container.GetControl<
RadTextBox
>("RadTextBox2", true);
Hello Daniel,
Thank you for using our services.
Can you please check what is the encoding of the .ascx files on your machine? By default it should be utf-8 which will present no problems with characters.
You can also take an alternative approach to this - using resource classes, in the same way we use them for the text on all labels and messages in Sitefinity. What has to be done is to create a class which will hold all of your resource texts. This class should inherit from Telerik.Sitefinity.Localization.Resource. Then on the initialize event of your module (for which you are building control) you have to register the resource class. If you are not using a module but a stand alone control you should register this resource class separately. This register should be done in OnInit event of the control for now, we are changing this to allow you to register resource classes in initialization event of the system. This approach gives you the ability to change the labels' text or translate it for other cultures through the Sitefinity administrative UI. I am attaching a small sample code library to illustrate what should be done for a stand alone control. Note that the code in OnInit event of the control will be moved to a more appropriate event with the Sitefinity 4.0 Beta 2 release.
Best wishes,
Radoslav Georgiev
the Telerik team
I am having the same issue with the current version of Sitefinity.
I checked the file encodings, they are UTF-8.
By the way, as Daniel reported before, the display problems occur for the text in attributes.
Using the resource files approach still the only workaround for this?
Thank you.
Hi Oguz,
Yes, you should apply this approach.
All the best,
Radoslav Georgiev
the Telerik team