C# 关闭页面和弹出页面,参数传值是汉字时

弹出页面:


    <script language="javascript">
    var pageweb;
    function openwin(pageweb){
    window.open(pageweb,"","width=400px,height=200px;toolbar=no, menubar=no, scrollbars=yes, resizable=yes");
    }

    </script>

    <a href="#" onclick="openwin('Default20.aspx')">asdfs</a>

关闭页面:


    <script language="javascript">

    var mes;
    function closewin(mes)
    {
    alert(mes);
    this.window.opener=null;
    window.close();
    }
    </script>

    this.Page.ClientScript.RegisterStartupScript(this.GetType(), "message", "<script>closewin('参数有误');</script>");

参数传值是中文时:

   strsql.Append("<td><a href=\"#\" onclick=\"openwin('QueryMaterialTimeDetail.aspx?timetype=" + Server.UrlEncode(litlelist[j].ToString()) + "&amp;client=" + strClient + "')\" >" + dt2.Rows[i][j].ToString() + " </a></td>");

 string timetype = Request.QueryString["timetype"].ToString();
 timetype = Server.UrlDecode(timetype);

原文地址:https://www.cnblogs.com/lgxll/p/2678661.html