在frame中左边是个动态菜单(treeview)右边是要显示的网站,在点击节点是frame中显示相关的网站
使用的是treeview控件动态加载的菜单
要怎么才能在点击节点时frame中显示相应的网站
一个页面是的代码是
public class _Default : System.Web.UI.Page
{
protected Microsoft.Web.UI.WebControls.TreeView TreeView1;
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
{
String parentId;
parentId = "@@ ";
this.TreeView1.TreeNodeSrc= "treeXML.aspx?parentId= "+parentId;
this.TreeView1.DataBind();
}
}
另一个页面的代码是
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;
using System.Data.SqlClient;
namespace treeView
{
/// <summary>
/// treeXML 的摘要说明。
/// </summary>
public class treeXML : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
if (!this.IsPostBack)
{
String parentId = Request.QueryString[ "parentId "];
if(parentId.Equals( " ")||parentId==null)
parentId = "@@ ";
Boolean isMulti = false;
SqlConnection conn=new SqlConnection( "server=.;uid=sa;database=test ");
SqlCommand com=new SqlCommand( "select * from treeview where parentId = ' "+parentId+ " ' ",conn);
conn.Open();
SqlDataReader dr=com.ExecuteReader();
string result = " ";
result = " <?xml version=\ "1.0\ " encoding=\ "UTF-8\ " ?> \n <TREENODES> ";
SqlConnection isMultiConn=new SqlConnection( "server=.;uid=sa;database=test ");
SqlCommand isMultiCmd=isMultiConn.CreateCommand();
string isMultiCmdSql,isMultiCmdSQL = "select Id from treeview where parentId= '{0} ' ";
isMultiCmd.Connection.Open();
while(dr.Read())
{
isMultiCmdSql = string.Format(isMultiCmdSQL,dr[ "id "].ToString());
isMultiCmd.CommandText = isMultiCmdSql;
SqlDataReader isMultiDr=isMultiCmd.ExecuteReader();
isMulti = false;
if(isMultiDr.HasRows)
isMulti = true;
isMultiDr.Close();
if (isMulti)
{
result+= "\n <treeNode Text=\ " "+dr[ "text "]
+ "\ " treeNodeSrc=\ "treeXML.aspx?parentId=