Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OdcTreeNodeContainer"/> class.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <param name="dataIndex">Index of the data.</param>
 public OdcTreeNodeContainer(OdcTreeNode node, int dataIndex)
 {
     this.dataItem      = node.DataItem;
     this.dataItemIndex = dataIndex;
     this.displayIndex  = dataIndex;
     this.node          = node;
 }
Example #2
0
 internal void Load(OdcTreeNode node)
 {
     node.ShowCheckBox     = showCheckBox;
     node.IsChecked        = isChecked;
     node.Text             = text;
     node.Value            = value;
     node.ImageUrl         = imageUrl;
     node.Key              = key;
     node.IsExpanded       = isExpanded;
     node.PopulateOnDemand = populate;
     node.ChildNodes.LoadViewState(childNodes);
     node.CssClass = cssClass;
 }
Example #3
0
        public void InstantiateIn(Control container)
        {
            OdcTreeNodeContainer item = (OdcTreeNodeContainer)container;
            OdcTreeNode          node = item.Node;

            if (!string.IsNullOrEmpty(node.ImageUrl))
            {
                System.Web.UI.WebControls.Image image = new System.Web.UI.WebControls.Image();
                image.ImageUrl = node.ImageUrl;
                image.Style.Add(HtmlTextWriterStyle.PaddingRight, "4px");
                image.CssClass = "cnt";
                //image.Style.Add(HtmlTextWriterStyle.VerticalAlign, "middle");
                image.EnableViewState = false;
                container.Controls.Add(image);
            }

            if (node.ShowCheckBox.HasValue && node.ShowCheckBox.Value == true)
            {
                WebControl cb = new WebControl(HtmlTextWriterTag.Input);
                //cb.Style.Add(HtmlTextWriterStyle.VerticalAlign, "middle");
                cb.CssClass = "cnt";
                cb.Attributes.Add("type", "checkbox");
                cb.EnableViewState = false;
                cb.Attributes.Add("event", "check");
                //                    cb.Height = 9;
                if (node.IsChecked)
                {
                    cb.Attributes.Add("checked", "checked");
                }
                container.Controls.Add(cb);
            }

            if (EditMode)
            {
                TextBox tb = new TextBox();
                tb.BorderStyle     = BorderStyle.None;
                tb.EnableViewState = false;
                tb.Text            = node.Text;
                tb.Attributes.Add("id", "edit");
                container.Controls.Add(tb);
            }
            else
            {
                Literal literal = new Literal();

                literal.EnableViewState = false;
                literal.Mode            = LiteralMode.Encode;
                literal.Text            = node.Text;
                container.Controls.Add(literal);
            }
        }
Example #4
0
            internal static TreeNodeState Create(OdcTreeNode node)
            {
                var state = new TreeNodeState
                {
                    text         = node.Text,
                    value        = node.Value,
                    imageUrl     = node.ImageUrl,
                    key          = node.Key,
                    isExpanded   = node.IsExpanded,
                    childNodes   = node.ChildNodes.SaveViewState(),
                    isChecked    = node.IsChecked,
                    showCheckBox = node.ShowCheckBox,
                    populate     = node.PopulateOnDemand,
                    cssClass     = node.CssClass,
                };

                return(state);
            }
Example #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OdcTreeNodeCheckEventArgs"/> class.
 /// </summary>
 /// <param name="node">The node.</param>
 /// <param name="isChecked">if set to <c>true</c> [is checked].</param>
 public OdcTreeNodeCheckEventArgs(OdcTreeNode node, bool isChecked)
     : base(node)
 {
     this.IsChecked = isChecked;
 }
Example #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OdcTreeViewCommandEventArgs"/> class.
 /// </summary>
 /// <param name="source">The source.</param>
 /// <param name="e">The <see cref="System.Web.UI.WebControls.CommandEventArgs"/> instance containing the event data.</param>
 /// <param name="node">The node.</param>
 public OdcTreeViewCommandEventArgs(Object source, CommandEventArgs e, OdcTreeNode node)
     : base(e)
 {
     this.Node   = node;
     this.Source = source;
 }
Example #7
0
 /// <summary>
 /// Initializes a new instance of the <see cref="OdcTreeNodeEventArgs"/> class.
 /// </summary>
 /// <param name="node">The node.</param>
 public OdcTreeNodeEventArgs(OdcTreeNode node)
     : base()
 {
     this.Node = node;
 }