November Happy Hour will be moved to Thursday December 5th.

Custom Property Save Data

Vote:
 

I have override following methods to assign data but unable to save the value to DB.

1) ApplyEditChanges - In Control

2) SetupEditControls - In control

3) Save Data - In Property

4) Load Data - In Property

But unable to save the actual value set in ApplyEditControl, as this value is not save to DB LoadData does not have any value to setup Controls. I have check in DB table tblProperty but no values are saved.

Any idea why the data is not stored in DB, I am using 5.2 R2 SP1.

Sanjay Zalke

#45221
Nov 02, 2010 19:07
Vote:
 

Quick Update, I have checked Itera.MultiProperty but did not get any difference in implementation.

To save I have to override ApplyEditChanges look like this.

public override void ApplyEditChanges()
{          
  CCProperty cp = this.PropertyData as CCProperty;
  string xml = GetValue(); // Get value entered earlier
  cp.Value = xml;
  SetValue(xml);
}
    
        public override void ApplyEditChanges()
        {
            ClubCategoryProperty cp = this.PropertyData as ClubCategoryProperty;
            // TODO : set the selected objects value
            
            //cp.Value = LAFitness.Utils.ClubCategoryHelperClass.CategoriesToXML(_editControl.Categories).ToString();
            // cp.Serialize();
            string xml = LAFitness.Utils.ClubCategoryHelperClass.CategoriesToXML(_editControl.Categories).InnerXml;
            SetValue(xml);
            base.SetValue(xml);
            cp.Value = xml;
            // Clear the session values
            //_editControl.ClearSelection();
        }
#45222
Edited, Nov 02, 2010 19:13
Vote:
 

I managed to save data for the first time only, on successive save, LoadData() keeps calling back and resetting the value to previous value. So the new value is lost.

        public override void LoadData(object value)
        {
            if (value != null)
                _val = value.ToString();
            base.LoadData(_val);
        }

    Do I need to set some flag/property to stop loading previous data? Help :(

Sanjay Zalke

#45363
Nov 04, 2010 16:00
* 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.