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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:00:02+00:00 2026-05-26T22:00:02+00:00

As my title says, I have a set property crash problem. Here’s the scenario:

  • 0

As my title says, I have a set property crash problem.

Here’s the scenario:

  1. I have created a simple custom ASP.Net server control that generates some text.
  2. I wanted to give design-time property for that text so its style can be accessed by developers from the properties window.
  3. All the properties in the properties window are working except the ones with the type System.Web.UI.WebControls.Style that I have created.

Here is my property:

[Bindable(true)]
[Category("Appearance")]
[Description("The style for the header")]
[Localizable(true)]
public Style HeaderTextStyle
{
  get
  {
    Style s = (Style)(ViewState["HeaderTextStyle"] == null ? Styles.defaultHeaderStyle : ViewState["HeaderTextStyle"]);
    return s;
  }

  set
  {
    ViewState["HeaderTextStyle"] = value;
  }
}

Oh and Styles.defaultHeaderStyle is just a property from an internal class that returns a new Style.

Let me point that the hanging/crashing occurs only when I CHANGE the property, so it cannot be from the getter.

I won’t paste my render control because the error occurs even when I’m not rendering anything.

What is it that causes this?

Thank you.

  • 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-26T22:00:03+00:00Added an answer on May 26, 2026 at 10:00 pm

    I found the answer to my problem.

    You see, the Style class is a property that has sub-properties and it is called a complex property. Complex properties ( a property that has subproperties) need custom state management to use view state. The Style class need design-time attributes to enable persistence within the control’s tags. So what I wrote in my original post will not work.

    For complete explanation visit: Server Control Properties Example from MSDN

    I managed to implement it using that example. I hope this will be useful to others out there.

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

Sidebar

Related Questions

As the title says, I have an UncaughtExceptionHandler set in my custom application class
OK, I don't think the title says it right... but here goes: I have
I have a simple asp.net user control: <%@ Control Language=C# AutoEventWireup=true CodeBehind=QueryDefinitionItem.ascx.cs Inherits=xxx.UserControls.QueryDefinitionItem %>
Like the title says, I have a problem with checkbox validation. So, I have
as already the title of my question says I have the problem that the
I just want what my title says.I have already read all the previous similar
As title says, I have a list of words, Like stopWords = [the, and,
As title says, I have access to the current listitem - and it's easy
The title says it mostly. If I have an object in Python and want
The title says enough I think. I have a full quality BufferedImage and 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.