We are localizing a webpart for Sharepoint 2013, and we will use a specific function to translate the terms (so we can switch from a database backed-up translation table to a resource and vice-versa).
For the html elements we are successfully using this, and it's working like a charm:
<td><%= MyNameSpace.MySubNameSpace.StaticClass.GetTranslation("My Text") %>:</td>
But for the asp controls the text is not working properly, although it compiles ok:
<asp:CheckBox ID="myCheckBox" runat="server" Checked="True" Text='<%# MyNameSpace.MySubNameSpace.StaticClass.GetTranslation("My Text") %>' />
The MyNameSpace.MySubNameSpace.StaticClass
is static, as well as the GetTranslation
function.
Any clue on this?
EDIT: There is a way I can write a function that loop all the asp controls, get their current text value and change it by passing it through my translation function? Something like this:
...
foreach(AspControl _control in WebPart.Controls)
{
if (_control.typeof() == <Control with Text properties>)
_control.Text = MyNameSpace.MySubNameSpace.StaticClass.GetTranslation(_control.Text);
}
...