Skip to content

Change FirstChildNode left position as same to its parent

KokLim Tan

Asked Sep 14, 2016, 6:49 PM EDT1 answer
Share
LinkedInX
I've been struggle to solve this problem in within one day but still unable to get rid on it. I've attached along picture to clarify on this problem to what I need. I've define a border to entire text area of nodes and those server control nodestyle seems to be only apply everythings inside the nodes area but not outside where you've to define your own ways.
 
Markup View:
CollapseImageUrl="~/App_Themes/PPHPG/Images/minus.png" OnTreeNodePopulate="ProductLineView_TreeNodePopulate">
Code Behind:
JavaScript
  var PreviousJobNumber = String.Empty;
  var NodeCount = 0;
  dynamic ActiveNode = null;
  dynamic StepCount = null;
  var JobDescription = String.Empty;
  this.ProductLineView.Nodes.Clear();
  foreach(var item in query)
 {
     dynamic SectionId = null;
     TreeNode DetailNode;
     if (PreviousJobNumber != item.ps_no)
    {
          PreviousJobNumber = item.ps_no;
          SectionId = item.Id.ToString();
          Int32 SectionValue = Convert.ToInt32(SectionId);
          JobDescription = timesheet.SectionGroups.Where(p => p.Id ==   SectionValue).Select(p =>       p.StockDescription).SingleOrDefault();

          TreeNode HeaderNode = new TreeNode();
           HeaderNode.Text = item.ps_no + "        " + "Receive Quantity" + "        " + "Target Quantity" + "        " + "Access";

           TreeNode DescriptionNode = new TreeNode();


           DescriptionNode.Text = JobDescription;
           DescriptionNode.Value = "Desc";                                                                HeaderNode.ChildNodes.Add(DescriptionNode);

           StepCount = 1;
           DetailNode = new TreeNode();
           DetailNode.Text = "(Step " + StepCount + ") " + SectionId;
           DetailNode.Value = SectionId;
           HeaderNode.ChildNodes.Add(DetailNode);
           this.ProductLineView.Nodes.Add(HeaderNode);

           ActiveNode = NodeCount;
           NodeCount += 1;
   }
   else
   {
          StepCount += 1;
          SectionId = item.Id.ToString();
          DetailNode = new TreeNode();
          DetailNode.Text = "(Step " + StepCount + ") " + SectionId;
          DetailNode.Value = SectionId;

          this.ProductLineView.Nodes[ActiveNode]
          .ChildNodes.Add(DetailNode);
    }
    this.ProductLineView.ExpandAll();
 }
    }
Thanks to anyone could help. 

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Add a class to the child node or if you don't have the access to add a class in child node then search for the class for the child node and add the below style to it.Childnode{ Position : relative; Left : -50px; -- change as per the alignment } ------ Using js Find the offest of the parent node and according to the parent node position set the child node Let me know if you want to do me and send all code
    0