无需使用Ajax工具即可设计面板和选项卡 [英] Design of panel and tabs without using ajax tools

查看:54
本文介绍了无需使用Ajax工具即可设计面板和选项卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在左侧有树状视图...因此对于每个子节点,我单击树状视图,我应该在右侧显示页面或面板...如何设计使用选项卡和面板的右侧部分

i am having treeview on the leftside...so for each childnode tat i click on the treeview, i should display the page or panel on right side...how to design the right side portion of using tabs and panel

推荐答案

注意:此响应是基于使用WinForms编写的:如果您正在做一些Web类型的事情,则TreeView的性质及其语义可能会改变:尽管如此,我认为这里显示的原理可以适应Web解决方案.

我认为您正在描述一个有一个TreeView的场景,在那个TreeView的右边有一个Container Control:问题是:当单击TreeView节点时,如何将准备好的UI放入该Container Control中? br/>
在这种情况下,如何定义每个可能的用户界面,每个节点一个,或者可能几个节点共享一个公用UI,作为UserControls.

您在TreeView中为AfterSelect事件定义一个EventHandler,然后执行正确的操作以在匹配的UI的右侧设置Container控件的内容.

您甚至可能有一个Dictionary< TreeNode,UserControl> ;,因此,在AfterSelect EventHandler中:
Note: this response is written based on using WinForms: if you''re doing some Web type thing, the nature of the TreeView, and its semantics, may change: nevertheless, I think the principles shown here can be adapted to a Web solution.

I think you are describing a scenario with one TreeView, and, to the right of that TreeView, one Container Control: and the question is: how do you put prepared UI''s into that Container Control when a TreeView Node is clicked ?

If that''s the case, how about defining each possible UI, one per Node, or perhaps several Nodes share one common UI, as UserControls.

You define an EventHandler for the AfterSelect event in the TreeView, and do the right thing to set the contents of the Container Control on the right to the matching UI.

You might even have a Dictionary<TreeNode, UserControl>, so, in the AfterSelect EventHandler:
private Dictionary<TreeNode, UserControl>  NodeUIDictionary = new Dictionary<TreeNode, UserControl>();

// assume you've done the right thing to fill the Dictionary with KeyValue Pairs,
// with the Keys being each TreeNode in the TreeView,
// and Values being references to instantiated UserControls !

private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
    ContainerControl.Controls.Clear();
    ContainerControl.Controls.Add(NodeUIDictionary[e.Node]);
}


这篇关于无需使用Ajax工具即可设计面板和选项卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆