Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Changing Selected/not Selected Property Dynamically



I'm trying to change a radio button property from a Edit plugin in the parent of some children pages. I am cloning each of the pages to make them writable. The problem is that I don't seem to be able to change the value of the Selected/not Selected property. However, I am able to change other properties that are text for example. I wonder if there is a special extra step that needs to be done for these type of properties (selected/not selected)?

Here's the code:

protected void SelectHeroImage_CheckedChanged(object sender, EventArgs e)
string pageID = ((CBSOutdoor.Classes.RepeatableRadioButton)(sender)).SelectedPageId;
foreach (PageData pd in ((PageDataCollection)imageList.DataSource))
//Get a writable PageData object to modify
//PageData myWritablePage = EPiServer.DataFactory.Instance.GetPage(pd.PageLink);
PageData myWritablePage = pd.CreateWritableClone();
if (pd.PageLink.ID == Convert.ToInt32(pageID))
myWritablePage.Property["HeroImage"].Value = true;
//myWritablePage.Property["Keywords"].Value = "Value is True";
myWritablePage.Property["HeroImage"].Value = false;
//myWritablePage.Property["Keywords"].Value = "Value is False";

//Perform 'Save and publish' programmatically
DataFactory.Instance.Save(myWritablePage, SaveAction.Publish);




Mar 10, 2009 13:09

When you check the value for a PropertyBoolean its either null or true:

    // its false
    // its true

So try to set it to null instead of false. Just an idea that came to mind. Havent tested it.



Mar 10, 2009 16:46



I got into almost the same problem myself regarding setting the value for a selected/not selected property. It seems that it's not possible to set the value in a dynamic property of type selected/not selected to the value "not selected". 

Read this thread for explanation:

Jun 05, 2009 14:10
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.