Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7764785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T15:00:16+00:00 2026-06-01T15:00:16+00:00

I have discovered that it is possible to populate resource strings with variable information

  • 0

I have discovered that it is possible to populate resource strings with variable information using string.format, see below:

String.Format(Resources.Temp.TempString, Resources.Contact.PhoneSales)

I can display this on my page using:

<p><%= String.Format(Resources.Temp.TempString, Resources.Contact.PhoneSales) %></p>

In some cases I have a Label or Literal (or any control) which might dynamically hide or show content. Ordinarily I would populate those using:

<asp:Literal ID="Literal1" Text="<%$ Resources:Temp,ContactUs %>" runat="server" />

I now would like the same String.Format functionality whilst still using controls. I found Display value of Resource without Label or Literal control but this doesn’t actually work for me, it just writes out ‘<%= GetGlobalResourceObject(“Messages”, “ThankYouLabel”) %>’ on the page (not the content, that actual string).

UPDATE:

I have found a solution which works with some controls:

<asp:Label runat="server" ID="temp"><%= String.Format(Resources.Temp.TempString, Resources.Contact.PhoneSales) %></asp:Label>

However, this works doesn’t work for Literal controls as they don’t allow child controls. I’d prefer to keep using Literal’s as they are the cleanest in terms of code generated, so still seeking a solution.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T15:00:18+00:00Added an answer on June 1, 2026 at 3:00 pm

    To solve my problem I have actually had a second look at how I am displaying content and found that a lot of times the Literals and Labels could be dropped in place of plain HTML code. I can then use my preferred method <%= ... %> to display content.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have just discovered a variable name that is misspelled. If it were hidden
I have discovered recently that's possible to call anoymous blocks from jdbc like this:
I have an application that's using Oracle.DataAccess to connect. I've already discovered that the
We have discovered that one of our auto generated assemblies is throwing a StackOverflowException
My testers have discovered that if you type free text into a file upload
I've been playing about with Runnable s and have discovered that if you postDelayed
As well as my question Removing MKMapView Annotations causes leaks. I have discovered that
I have recently discovered that I am affected by this bug http://www.mail-archive.com/mono-bugs@lists.ximian.com/msg71515.html Well, at
I recently discovered that when you have a page set to session readonly and
I have a website, and I just discovered that somehow someone injected JavaScript on

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.