Files
17168ERP/web/App_Code/CustomNode.cs
2025-08-29 01:27:25 +08:00

67 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Web;
using System.Collections.Specialized;
using System.Web.UI;
using System.Web.UI.WebControls;
public class CustomTreeNode : TreeNode
{
public CustomTreeNode()
: base()
{
}
/// <summary>
/// used to store Node Attributes
/// </summary>
private NameValueCollection _Attributes = new NameValueCollection();
/// <summary>
///used to store the CSS Class applied to a node.
/// </summary>
private string _cssClass;
/// <summary>
/// Property used to set the CSS Class applied to a Node
/// </summary>
public string cssClass
{
get { return _cssClass; }
set { _cssClass = value; }
}
/// <summary>
/// Property used to add Attributes to a node
/// </summary>
public NameValueCollection Attributes
{
get { return this._Attributes; }
set { this._Attributes = value; }
}
/// <summary>
/// add additional rendering to the node
/// Add a div Tag and a class Attribute
/// </summary>
/// <param name="writer">represents the output stream used to write content to a Web page</param>
protected override void RenderPreText(HtmlTextWriter writer)
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, cssClass);
writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "loadingShow(this)");
//執行取得座標的java函式
writer.RenderBeginTag(HtmlTextWriterTag.Div);
base.RenderPreText(writer);
}
/// <summary>
/// add additional rendering to the node
/// End Tag
/// </summary>
/// <param name="writer">represents the output stream used to write content to a Web page</param>
protected override void RenderPostText(HtmlTextWriter writer)
{
writer.RenderEndTag();
base.RenderPostText(writer);
}
}