左右分割页面的问题
求助:我想把一个单独的页面上分割成2个部分:左边和右边(类似于mop的大杂烩),左边放TreeView,右面放另外的用户控件(将来根据点击左边树上不同的节点,来刷新右面的页面).
我在左边放了一个TreeView,在右面放了一个panel.
问题是:每次我点击左边的树的时候,整个页面都要刷新一次,而且,更糟糕的是,右面用户控件上的按钮不能再使用.也就是说,我想实现点击左边的节点,只刷新右面的页面.请问高手怎么解决?
[解决办法]
用到asp.net ajax控件
.aspx
<cc1:Accordion ID= "Accordion1 " runat= "server " SelectedIndex= "0 "
HeaderCssClass= "menuHeader " ContentCssClass= "menuContent "
FadeTransitions= "false " FramesPerSecond= "50 " TransitionDuration= "100 "
AutoSize= "None " RequireOpenedPane= "false " SuppressHeaderPostbacks= "true ">
</cc1:Accordion>
.cs
private TreeView treeContent;
Form f = new Form();
DataSet ds = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
AjaxControlToolkit.AccordionPane pane;
Label lblHeader;
ds = f.Load();
ds.Tables[0].DefaultView.RowFilter = "ParentId is null ";
DataTable dt0 = ds.Tables[0].DefaultView.ToTable();
for (int i = 0; i < dt0.Rows.Count; i++)
{
pane = new AjaxControlToolkit.AccordionPane();
//第一级菜单
lblHeader = new Label();
lblHeader.Font.Bold = true;
lblHeader.Text = dt0.Rows[i][ "FormName "].ToString();
pane.HeaderContainer.Controls.Add(lblHeader);
treeContent = new TreeView();
BindContent(null, Convert.ToInt32(dt0.Rows[i][ "FormId "]));
pane.ContentContainer.Controls.Add(treeContent);
this.Accordion1.Panes.Add(pane);
}
}
private void BindContent(TreeNode currentNode, int FormId)
{
TreeNode node;
ds.Tables[0].DefaultView.RowFilter = "ParentId = " + FormId;
DataTable dt = ds.Tables[0].DefaultView.ToTable();
for (int i = 0; i < dt.Rows.Count; i++)
{
node = new TreeNode();
node.Text = dt.Rows[i][ "FormName "].ToString();
if (String.IsNullOrEmpty(dt.Rows[i][ "ParentId "].ToString()))
{
node.NavigateUrl = "# ";
}
else
{
node.NavigateUrl = "articlelist.aspx?id= "+ dt.Rows[i][ "FormId "].ToString();
node.ImageUrl = "_images/a.gif ";
node.Target = "mainFrame ";
}
if (currentNode != null)
{
currentNode.ChildNodes.Add(node);
}
else
{
treeContent.Nodes.Add(node);
}
BindContent(node, Convert.ToInt32(dt.Rows[i][ "FormId "]));
}
}
[解决办法]
不好意思就借了cdsn的框架网页。
<frameset id= "sidebar_content " cols= "230, * "(调左右的大小) frameborder= "1 " border= "6 " framespacing= "5 " bordercolor= "#A1C7F9 ">
<frame name= "sidebarFrame " src= "http://www.csdn.net/frameset/sidebar.htm " scrolling= "no " frameborder= "1 " />
<frame name= "ContentFrame " src= "http://community.csdn.net/index.htm " frameborder= "0 " />
</frameset>
假设在左边的http://www.csdn.net/frameset/sidebar.htm中有一个链接,想让它在右边显示用
<a href= " " target= "ContentFrame "(右边框架的名字)>