Combine two resource keys for a single .Net label

To make an existing site multilingual, I follow the globalization method, I created 3 resource files for other content, such as a text label file and a header file, a text file for the grid header, etc. .... Now I have two keys in different resource files : ie Email and Message, in third place I want to show both of these keywords together. Email message. Do I need to create a third key, or can I concatenate existing keys. I am currently using below two codes

For showing directly on page:
HttpContext.GetGlobalResourceObject("ResourceLabelButton", "Email")

For showing as text of any control like Textbox, label:
Text ="<%$ Resources:ResourceContent, Email %>"

I can combine the two resource lines on the .cs page, but this will increase the timeline, so please suggest that I can only change .aspx pages.

Thank you in advance

+4
source share
6 answers

ASP.NET tag attribute values ​​that use <% $ Something: Something Else%> have a special syntax called ASP.NET Expressions . Using them as attribute values ​​is pretty much all or nothing; There is no way to add any code to an .aspx file to manipulate what these expressions evaluate to. You will need to do this in code.

+3
source

You should create a separate resource record for "Email Message", not the concatenation of "Email" and "Message". To understand why, look at Spanish:

  • Email = Correo electrónico
  • = Mensaje

Correo electrónico Mensaje. . :

  • = Mensaje de correo electrónico

, "Email" "Message" , (de, "of" ).

, " " " ":

  • = Mensaje nuevo
  • = Último mensaje

, , , de. , .

, , , .
.

+1

, , :

<asp:Label id="lbl1" runat="server" Text="Email: <%= HttpContext.GetGlobalResourceObject("ResourceContent", "Email") %>">

GetLocalResourceObject GetGlobalResourceObject

+1

, ,

0

<asp:Label ID="lblNameAndNos" runat="server">
<%= ""+ Resources.Resources.Name + "/" + Resources.Resources.Nos %>  
</asp:Label>

Text

0

:

Text ="<%$ Resources:ResourceContent, Email %>&nbsp;<%$ Resources:ResourceContent, Message %>"
-1

All Articles