Loading...

All project content is available for reading, but you need to be a member of the project for Subversion checkout of source code, or to create/modify any information.
Login if you are a member. Apply here to request membership (open to all).

Ticket #88 (closed defect: fixed)

Opened 9 years ago

Last modified 9 years ago

Null the property

Reported by: mikael.gidmark@… Owned by: anders.hattestad@…
Priority: major Component: IteraMultiProperty
Keywords: Cc:

Description

If you empty all your fields the property still won't be null. It will still contain a string even though all it's values are empty

Change History

comment:1 Changed 9 years ago by anders.hattestad@…

Have made a change. Does this solve the problem?

comment:2 Changed 9 years ago by mikael.gidmark@…

Seems like i had a pretty old version since most seems pretty changed. I can't even output the property contents from the code behind like i did before.
Shouldn't Placeholder placeholder = pageproperty? as Placeholder; work ? Or atleast Placeholder.Parse(...)

comment:3 Changed 9 years ago by anders.hattestad@…

CurrentPage["property"] gives you only the string value (CurrentPage.Property["property"] as PropertyMultiBase).PropertyCollection gives you your children properties

comment:4 Changed 9 years ago by mikael.gidmark@…

If i enter some values into my custom property called Placeholder, save and then remove and save again it still won't be null.

            Placeholder placeholder = page.Property["property"] as Placeholder;
            if (placeholder != null)
            { ... }

comment:5 Changed 9 years ago by anders.hattestad@…

placeholder will never be null, maybe placeholder.IsNull? could be, but the Property as is will not return IsNull true if the PropertyCollection is empty

comment:6 Changed 9 years ago by mikael.gidmark@…

IsNull returns false.

So there isn't a way to tell if the whole property is null then. That's a shame.

comment:7 Changed 9 years ago by anders.hattestad@…

  • Status changed from new to closed
  • Resolution set to fixed

Of course there is a way to tell if the Property have zero sub elements

(Page.Property["property"] as PropertyMultiBase).PropertyCollection?.Count==0

So its pretty easy to implement into the code.

comment:8 Changed 9 years ago by mikael.gidmark@…

That wasn't what i was after, since my property has sub elements, but they all have null values (IsNull = true that is) while the head property (or what to call it) has IsNull = false

comment:9 Changed 9 years ago by anders.hattestad@…

Think what you are after is better resolved by make your own logic. you need only too loop over the sub properties and check them.

It is "wrong" to say that the master property is null if it have sub elements.

Note: See HelpUser/Tickets for help on using tickets.