How do I concatenate 2 resource strings together in an aspx page

前端 未结 8 2143
日久生厌
日久生厌 2021-01-04 08:27

I have a localised ASP.net application (.net 2.0). I wish to concatenate 2 strings retrieved from the resource file together into one element, something like this.



        
相关标签:
8条回答
  • 2021-01-04 08:51

    Try "@(Resources.ResourceString + Resources.ResourceString)"

    0 讨论(0)
  • 2021-01-04 08:52

    I was having the same issue, and I solved it by using this option instead:

    Text="<%= HttpContext.GetGlobalResourceObject("Resource", "lw_name") %> <%= HttpContext.GetGlobalResourceObject("Resource", "lw_required") %>"
    

    For local Resources, use the GetLocalResourceObject method instead of GetGlobalResourceObject

    0 讨论(0)
  • 2021-01-04 08:52

    This Might Be of Help

    <asp:Label ID="Mylabel" runat="server">  
      
    <%= "before Message String- "+ Resources.MyResources.Message +" -After Message String " %> 
    
    </asp:Label>
    

    Note the concatenation is not on the Text attribute but between the label element Full post can be found here

    0 讨论(0)
  • 2021-01-04 08:53

    I search for the solution so long This code works for me:

    ToolTip='<%# Resources.Global.Btn_Edit + "/" + Resources.Global.Btn_contact %>'
    
    0 讨论(0)
  • 2021-01-04 08:57

    Use this method to append 2 strings in ASPX.

    Text='<%# String.Format("{0} {1}", 
          Resources.file01.string1,Resources.file01.string2)%>'
    
    0 讨论(0)
  • 2021-01-04 09:00

    I know you said you tried eval but what about something like this:

    Text='<%# string.Format("{0}{1}",Eval("lw_name"),Eval("lw_required")) %>'

    0 讨论(0)
提交回复
热议问题