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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:45:54+00:00 2026-05-15T12:45:54+00:00

In a project in C# (.Net 2.0) I use a propertygrid. This propertygrid displays

  • 0

In a project in C# (.Net 2.0) I use a propertygrid. This propertygrid displays objects retrieved from a PHP backend via SOAP. Some objects contain string properties where the meaning of an empty string is different compared to the meaning of a string that’s NULL. An example of an object returned by a SOAP call might be:

SomeObject {
  PropertyA = "Foo"
  PropertyB = "Bar"
  PropertyC = Null
}

As long as I don’t “touch” PropertyC in the PropertyGrid, the value of PropertyC will remain null. When I enter “foobar” as value and then clear the text in the propertygrid for PropertyC the value will equal an empty string. This is all fine by me; the user should be able to “enter” an empty string. But I also want the user to be able to specify a “null” value.

The way I envision this is that the user can Right-click the value of the property and a context-menu will pop-up with a “Clear value” option which would set the value to Null.

Important: I do not want to use a “magic value” like the string “Null” or “Magix123” to specify the value needs to be null. Ofcourse, the backend could interpret these values and store an actual null but this “solution” is, apart from being plain dirty, not wanted because it would require changing a lot of code all over the place handling the “Magic values”.

Ideally the PropertyGrid would also display a null value as (“grayed”) “” so the user can see the difference between an empty string and a Null value.

Anyone have an idea on how to handle this kind of situation? Does the (.Net 2.0!) PropertyGrid allow me to do this kind of stuff? And how would I have to go about it then? Would I need to create my own usercontrol derived from a PropertyGrid or does the PropertyGrid have some function(s) I missed?

  • 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-15T12:45:54+00:00Added an answer on May 15, 2026 at 12:45 pm

    Adding a DefaultValueAttribute with default value null to the property should enable the command Reset in the context menu.
    For further customization you will probably have to add an EditorAttribute and write a custom UITypeEditor.

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

Sidebar

Related Questions

How to use .Net System.IO; System.Net; System.Net.Sockets; libs from Visual Studio C++ project?
I'm starting a new ASP.NET project that I'm trying to use some jQuery with,
I don't use .Net unless I have to, and for this project I have
I have a .Net project called: Whatever.Web.UI: I use this project to put all
So Im maintaining some reports in a VS2005 .NET project. The reports use object
In my Asp.Net project I wanna use Property Auto-wiring, e.g. for my ILogger. Basically
I'm trying to use .NET HttpListener in a C# project. When I register my
I'm currently on a VB.NET project and wish to use a KeyValuePair to facilitate
I want to create a vb.net project that I will use to only hold
So I'm working on a ASP.NET project and tried to use a jQuery script

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.