您的位置:首页 > 运维架构

dropdownlist下拉列表+框架实现页面转向

2007-10-06 23:03 405 查看
首先三个文件

baobiao/liucheng.aspx \\框架文件

baobiao/liucheng_zhuan.aspx \\dropdownlist控件

baobiao/liucheng_xianshi.aspx \\显示 链接的页

1.//liucheng.aspx文件

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="liucheng.aspx.cs" Inherits="baobiao_biao1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />

<title>无标题文档</title>

</head>

<frameset rows="80,*,80" frameborder="no" border="0" framespacing="0">

<frame src="liucheng_zhuan.aspx?sh=0" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />

<frame src="liucheng_xianshi.aspx" name="manframe" id="manframe" title="manframe" />

</frameset>

<noframes><body>

</body>

</noframes></html>

2.liucheng_zhuan.aspx主要文件

界面层文件code

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged1">

</asp:DropDownList> </div>

绑定文件代码

code con = new code();

protected void Page_Load(object sender, EventArgs e)

{

Session["empid"] = 133;

this.xianshi();

}

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)

{

}

/// <summary>

/// 根据参数显示下拉列表内容

/// </summary>

private void xianshi()

{

if (!IsPostBack)

{

string strsql = "";

if (Request["sh"] != null)

{

if (Request["sh"].ToString() == "0")

{

strsql = "select * from td_rep_process where rep_oneshow like '%;" + Session["empid"].ToString() + ";%'";

}

else if (Request["sh"].ToString() == "1")

{

strsql = "select * from td_rep_process where rep_towshow like '%;" + Session["empid"].ToString() + ";%'";

}

con.XiaLaBiao(strsql, DropDownList1, "rep_name", "rep_id");

}

}

}

protected void DropDownList1_SelectedIndexChanged1(object sender, EventArgs e)

{

string strsql = "select * from td_rep_process where rep_id =" + Request["DropDownList1"].ToString() + "";

DataSet ds = con.conDataSet(strsql);

foreach (DataRow row in ds.Tables[0].Rows)

{

RegisterStartupScript("", "<script language=\"javascript\"> window.open('" + row["rep_sjpwfrm"].ToString() + "?deptid=1&dep=岱岳区供电部&sh=" + Request["sh"].ToString() + "', target = \"manframe\");</script>"); //实现页面转向manframe框架中,registerstartupscript应用.

}

}

}

这里用到一个code

public static string htmlfilename;

/// <summary>

/// code 的摘要说明

/// </summary>

public class code

{

public static string htmlfilename;

public code()

{

//

// TODO: 在此处添加构造函数逻辑

//

}

///<summary>

/// 绑定gridview 第一参数:string sql,第二参数:GridView gridview

/// </summary>

public void BDGridView(string sql, GridView gridview)

{

System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings["ConnString"].ConnectionString.ToString());

try

{

con.Open();

string strcom = sql;

System.Data.SqlClient.SqlDataAdapter rs = new System.Data.SqlClient.SqlDataAdapter(sql, con);

DataSet ds = new DataSet();

rs.Fill(ds);

gridview.DataSource = ds.Tables[0].DefaultView;/

gridview.DataBind();

}

finally

{

con.Close();

}

}

liucheng_xianshi.aspx文件可以设置一个其实显示页面.

下载源文件

les/9who/baobiao.rar
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐