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

Insert child nodes gridview cells are blank

1 Answer 59 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Mark
Top achievements
Rank 1
Mark asked on 04 Mar 2014, 08:57 AM
I have a TreeListView with 6 additional columns, loading approx 200 nodes.

When the user selects a currency from a combobox the VM adds additional nodes to the leaf nodes and updates some totals on some parent nodes.

The update works but when inserting the new child nodes the label in the first column populates but none of the gridview values are displayed. The same cells updated on the parent display the new value.

A second issue is that I would like to add an image to the hierarchy column but cannot work out how to style the cell.

I attach the VM code.

private void SetNode(TreeNodeStrategy oParentNode)
        {
            oParentNode.CurrencyType = string.Empty;
            oParentNode.RateIndex = string.Empty;
            oParentNode.RateType = string.Empty;
            oParentNode.Frequency = string.Empty;
            oParentNode.FaceAmount = 0;
            oParentNode.BookValue = 0;
            oParentNode.Apportion = 0;
            //Update existing node total - works fine
            NodeCurrencyTypeDB oNCT = lNodeCurrencyType.Where(x => x.NodeKey == oParentNode.NodeKey & x.CurrencyType == SelectedCurrencyType).FirstOrDefault();
            if (oNCT != null)
            {
                oParentNode.FaceAmount = oNCT.Amount;
            }
 
            //add the new child nodes to the parent node - node is added but the gridview value do not display
            if (lStrategyConfig.Where(x => x.NodeKey == oParentNode.NodeKey & x.CurrencyType == SelectedCurrencyType).Count() > 0)
            {              
                List<TreeNodeStrategy> lNodes = new List<TreeNodeStrategy>();
                foreach (StrategyConfigDB oConfig in lStrategyConfig.Where(x => x.NodeKey == oParentNode.NodeKey & x.CurrencyType == SelectedCurrencyType))
                {
                    string sNodeKey = string.Format("{0}{1}/", oParentNode.NodeKey, oConfig.StrategyConfigID);
                    TreeNodeStrategy oNode = new TreeNodeStrategy(oConfig.RateIndex, oParentNode, null, oConfig, sNodeKey, oParentNode.ChildNodes.Count());
                    oNode.CurrencyType = oConfig.CurrencyType;
                    oNode.RateIndex = oConfig.RateIndex;
                    oNode.RateType = oConfig.RateType;
                    oNode.Frequency = oConfig.ReferenceName;
                    oNode.FaceAmount = oConfig.FaceAmount;
                    oNode.BookValue = oConfig.BookValue;
                    oNode.Apportion = oConfig.Apportion;
                    lNodes.Add(oNode);
                }
                oParentNode.ChildNodes = lNodes.ToObservableCollection();
            }
        }

1 Answer, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 07 Mar 2014, 03:24 PM
Hello Mark,

Let me go straight to your questions:

1. I am afraid that with the supplied information I cannot figure out what is going on. Would it be possible to share with us more details on your exact implementation? It would be great if you can send me a small sample with dummy data in order to investigate the issue locally.
2. In order to achieve your goal, you can use CelltemplateSelector. Please check this help article for a reference.

Looking forward to hearing from you! 


Regards,
Yoan
Telerik

DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

Tags
TreeListView
Asked by
Mark
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Share this question
or