RadTreeView:How to add controls to a node
来源:互联网 发布:纳美旅游知乎 编辑:程序博客网 时间:2024/06/05 17:05
While you can always use an item template to customize the appearance of the nodes in a tree view, another
approach is to simply add controls directly to the Controlscollection of a node in the code-behind. This gives
you the power to customize nodes in the code-behind without having to implement an ITemplate class.
The following example illustrates how to add controls to the Controls collection of a node. It adds a color picker
to the nodes of a tree view when the page first loads. Once controls are added to the Controls collection, the
node no longer displays its Textproperty, but instead shows only the controls that were added.
protected void Page_Load(object sender, EventArgs e){// Go through all of the nodes in the tree viewforeach (RadTreeNode node in RadTreeView1.GetAllNodes()){// Replace nodes with the text "Color" by a color pickerif (node.Text == "Color"){RadColorPicker colors = new RadColorPicker();colors.ID = node.ID + "_colors";colors.Preset = ColorPreset.Opulent;colors.ShowEmptyColor = false;colors.PreviewColor = false;// add the color picker to the controls collectionnode.Controls.Add(colors);}}}
Gotcha!
Be sure to add the controls every time the page loads, not just when IsPostBackis false.
Controls that are added this way do not persist in the View State.
- RadTreeView:How to add controls to a node
- How to add a node to an mnesia cluster?
- Gluster FS - How to add and remove a node
- SiteMap Controls: How to add a duplicate link in the web.sitemap
- How to add a button to PreferenceScreen
- Dynamically Add Controls to a Form with Visual Basic 6.0
- How to initialize child controls in a derived CDialogBar
- How to initialize child controls in a derived CDialogBar
- How To Add a TwoFields Validator
- How to add a .dll file ?
- How to add a Linux service
- ABAP---How to use controls
- ABAP---How to use controls
- How to use C# controls
- How to add a user to a group
- WinForms Controls > Examples > How to: Add New XtraForm, RibbonForm and XtraUserControl to Your Proj
- How to clone a scene node
- How to create a sysfs file node
- NAND FLASH 调研和选型(转载)
- 2013 即将上映电影
- Java 加密解密
- Servle 文件下载
- Spring PropertyPlaceholderConfigurer with Velocity
- RadTreeView:How to add controls to a node
- 学习电子书收藏
- 音视频即时通讯开发功能介绍
- 模板匹配算法简介
- 关于flash在html的引用 ——OBJECT EMBED
- 蓝牙安全浅析
- Robotlegs AS3入门介绍 第二部分:Models(模型)
- 透视投影
- 对称平方数