ASP.NET GlobalResources.. Use <%$ or <%= embedded code?
-
I'm working on trying to make my website for multiple languages. Based on my reading I am looking at creating a LocalizedText.resx file as the fall-back language (English) when it doesn't detect. Anyways I have to work on replacing all the text to read from this file (or the other languages files). The documentation says use <%$ Resources:LocalizedText, %> but the problem is you can't just put them on a page. You have to use the Text= within a control or Literal. Can I not just do <%= Resources.LocalizedText.mykey %> instead? I would hate to replace ALL text with a control... wouldn't that just increase the viewstate on the page?
-
I'm working on trying to make my website for multiple languages. Based on my reading I am looking at creating a LocalizedText.resx file as the fall-back language (English) when it doesn't detect. Anyways I have to work on replacing all the text to read from this file (or the other languages files). The documentation says use <%$ Resources:LocalizedText, %> but the problem is you can't just put them on a page. You have to use the Text= within a control or Literal. Can I not just do <%= Resources.LocalizedText.mykey %> instead? I would hate to replace ALL text with a control... wouldn't that just increase the viewstate on the page?
Why not try it and see if it works? With regards ViewState, you can set
EnableViewState="false"
either for an individual control, or at the page level if you can get away with that.