This is a migrated thread and some comments may be shown as answers.

Custom GridColumnEditor

1 Answer 31 Views
Grid
This is a migrated thread and some comments may be shown as answers.
HK
Top achievements
Rank 1
HK asked on 22 Oct 2010, 12:27 PM

Hi,

I have created a custom GridColumnEditor that extends GridTextColumnEditor. My custom editor holds a composite control (consisting of a textbox and some other controls) that is used for editing the value. The composite controls shows up with the correct value when I press the edit button, but I have problems extracting the new value when I press the save button, I always get the old value.

I use the following for extracting the new value: (EditItem.Value (which is the textbox value)  always has the old value)


List
<UIPhaseItem> items = new List<UIPhaseItem>();

foreach
(GridColumn column in e.Item.OwnerTableView.RenderColumns)
{
    if (column is IGridEditableColumn)
    {
        IGridEditableColumn editableCol = (column as IGridEditableColumn);
        if (editableCol.IsEditable)
        {
            IGridColumnEditor editor = editManager.GetColumnEditor(editableCol);
            if (editor is CustomColumnEditor)
            {
                items.Add(((CustomColumnEditor)editor).EditItem);     
            }
        }
    }
}

Any ideas?

Below is my custom column editor.

public class CustomColumnEditor : GridTextBoxColumnEditor
    {
        Public UIPhaseItem EditItem { get; set;}
  
        public CustomColumnEditor(UIPhaseItem item, long id)
        {
            this.EditItem = item;
            this.EditItem.Enabled = true;
            this.EditItem.Visible = true;
            this.EditItem.ID = id.ToString();
        }
  
        protected override void AddControlsToContainer()
        {
            this.ContainerControl.Controls.Add(EditItem);
        }
  
        protected override void LoadControlsFromContainer()
        {
            this.EditItem = (UIPhaseItem)this.ContainerControl.Controls[0];
        }
}

1 Answer, 1 is accepted

Sort by
0
Marin
Telerik team
answered on 26 Oct 2010, 01:04 PM
Hello HK,

From what I see from the code snippets I can verify it looks ok.  Can you post full code sample or working application so we can try to reproduce the issue on our side? Meanwhile you may also refer to this help article for further information building custom editors.

Kind regards,
Marin
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
HK
Top achievements
Rank 1
Answers by
Marin
Telerik team
Share this question
or