如何使用 Teleriks RadTreeView 控件将 DataBoundItems 添加到特定节点?
Teleriks RadTreeView 控件上的 AppendDataBoundItems 属性允许您将数据与静态值一起绑定。
因此,您的树可能看起来像
- Static Item A
- Static Item B
- Static Item C
- Databound Item A
- Databound Item B
- Databound Item C
但我希望将所有绑定值放在特定节点下,例如
- Static Item A
- Static Item B
- Static Item C
- 数据绑定项 A
- 数据绑定项目 B
- 数据绑定项 C
我确实意识到我可以操纵数据来实现此效果,但我不太愿意将 UI 代码移至我的存储过程中。
还有其他办法吗?
The AppendDataBoundItems property on Teleriks RadTreeView control allows you to bind data along side your static values.
So your tree might look like
- Static Item A
- Static Item B
- Static Item C
- Databound Item A
- Databound Item B
- Databound Item C
But I'd like to have all my bound values under a specific node, like
- Static Item A
- Static Item B
- Static Item C
- Databound Item A
- Databound Item B
- Databound Item C
I do realize I can manipulate the data to accomplish this effect, but I'm not comfortable moving UI code into my stored proc.
Is there any other way?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我会让存储过程将您的数据返回到您将绑定到树视图的数据集中。一旦您获得数据集,我将操作数据集中保存的数据并将修改后的数据集绑定到您的树视图。存储过程仍在返回您的数据绑定数据,然后您就在玩中间人游戏。
I would have the stored proc return your data into the dataset that you're going to be binding to your treeview. Once you've got the dataset back, I would manipulate the data held in your dataset and bind the modified dataset to your treeview. The stored proc is still returning your databound data, and then you're playing man-in-the-middle.
我开始认为这是不可能的,所以我自己添加了这些项目。
以下是手动方式,供其他寻求如何执行此操作的人将来参考。
Default2.aspx
我的代码隐藏文件是
I'm starting to think this isn't possible, so I just added the items myself.
For future reference to anybody else looking for how to do this, here is the manual way.
Default2.aspx
And my code behind file is