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

首先三个文件
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>&nbsp;</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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值