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 7183803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:04:14+00:00 2026-05-28T18:04:14+00:00

This would seem to be very simple, but it’s not working for me. I

  • 0

This would seem to be very simple, but it’s not working for me. I desparately need to know how to override the “Text” property of a server control I created, which inherits from “Label”. When the control is dropped into an ASP Web form, I want the text property to already be set to a certain value. I tried:

[Browsable(true), Bindable(true), Category("Behavior"), Localizable(true)]
[DefaultValue("00:00:00")]
public override string Text{get; set;}

But it doesnt work; the “Text” property shows up blank – and when I try to edit it, I can change it to anything except the value specified in the “DefaultValue” attrib. This property is supposed to be overridable.

I also need to be able to set the “ID” property so it’s set to a specific value when dropped on the form. Is this possible?

Any suggestions would be greatly appreciated!

  • 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-05-28T18:04:14+00:00Added an answer on May 28, 2026 at 6:04 pm

    For this you can use the ToolBoxDataAttribute:

    Specifies the default tag generated for a custom control when it is
    dragged from a toolbox in a tool such as Microsoft Visual Studio.

    By default, the visual designer of a tool such as Visual Studio,
    creates an empty tag. This is a tag representing a control in its
    default state, when the control is dropped from the toolbox of a
    visual designer onto the design surface. To specify initial default
    values, a control can make use of this attribute. You can use this
    attribute to customize the initial HTML content that is placed in the
    designer when the control is dragged from the toolbox onto the form.

    It would look something like this for your control:

    [ToolBoxData("<{0}:TimeLabel ID='TL1' Text='00:00:00' runat='server' />")]
    public class TimeLabel : System.Web.UI.WebControls.Label
    {
      [DefaultValue("00:00:00")]
      public override string Text
      {
        get { return ViewState["Text"] != null ? (string)ViewState["Text"] : "00:00:00"; }
        set { ViewState["Text"] = value; }
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This one is probably very simple, but I can't seem to get it working.
This may seem to be an academic question, but still I would be very
I'm sure this has a very simple answer, but I can't seem to find
This is a very stupid thing, I know, but I just don't seem to
I know this is a very simple question but I have been struggling with
This might seem like a very simple question, but I am struggling with it.
I know this is a very simple question, but I'm having trouble finding the
This probably seems like a very simple question, and I would probably know if
I assumed joinable would indicate this, however, it does not seem to be the
The people on this website seem to know everything so I figured I would

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.