Changing Selected/not Selected Property Dynamically

Member since: 2002


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);




#28478 Mar 10, 2009 13:09
  • Member since: 2003

    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.



    #28481 Mar 10, 2009 16:46
  • Member since: 2006



    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:

    #30199 Jun 05, 2009 14:10