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

  • SEARCH
  • Home
  • 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 8146075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:52:16+00:00 2026-06-06T13:52:16+00:00

FOUND THE ANSWER MYSELF, see below… I’d like to have a very simple user

  • 0

FOUND THE ANSWER MYSELF, see below…

I’d like to have a very simple user control…

<mw:Translate LocalizedText="Some text" />

This results in “Some text” in output.

However, if I put it like this:

<mw:Translate ID="translate1" LocalizedText="Some text" />Some other text</mw:Translate>
<mw:Translate ID="translate2"/>Some other text</mw:Translate>

ID=translate1 results in “Some text” while ID=translate2 renders “Some other text”

Simply, if the LocalizedText attribute is not set, then the text inside the translate tag is rendered. If neither LocalizedText, nor a text inside the element are set, empty string is rendered.

For clarification, LocalizedText attribute is prefered. So if the mw:Translate tag body and the LocalizedText are set, Localized Text is rendered.

I’m writting this just because I’m not sure how to set correctly the UserControl property attributes…

using System.Web.UI;
using System.ComponentModel;
using System;
namespace MagicWare.Web.UI.WebControls
{
    [PersistChildren(false)]
    [ParseChildren(true, "InsideText")]
    public class Translate : System.Web.UI.WebControls.Literal
    {
        public string LocalizedText
        {
            get { return Text; }
            set { this.Text = Translations.Translate(Value); }
        }

        [PersistenceMode(PersistenceMode.InnerDefaultProperty)]
        public string InsideText { get; set; }

        protected override void Render(HtmlTextWriter writer)
        {
            if (!String.IsNullOrEmpty(Text))
            {
                writer.Write(Text);
                return;
            }
            if (!String.IsNullOrWhiteSpace(InsideText))
            {
                writer.Write(InsideText);
                return;
            }
            writer.Write("");
        }
    }
}

ANSWER

Everything i needed to know was the existence of the interface ITextControl. With it, I just implement a “Text” attribute, which contains the text put inside the tags so it works like the literal control.

  • 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-06T13:52:19+00:00Added an answer on June 6, 2026 at 1:52 pm

    Everything i needed to know was the existence of the interface ITextControl. With it, I just implement a “Text” attribute, which contains the text put inside the tags so it works like the literal control.

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

Sidebar

Related Questions

Hopefully a simple question although one I have found impossible to answer myself using
EDIT: I found myself an answer (see below) how to align the images within
Sorry, found answer by myself (at the bottom of question) I'm implementing simple google
My question is very trivial, yet I didn't found the answer myself: Where does
This is probably a question that has an easy/simple/obvious answer, but I've found myself
This is probably a very simple question, but at this time I have myself
I found this answer and it sounds like almost exactly what I'm doing. I
I have searched but have not found my answer. Disclaimer: I am brand new
I have a question to which I have not found an answer. Let's say
EDIT: Answer found! Thank you very much people, a lot of answers worked, I

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.