• C# 后台生成javascript


                <td class="TDTitle" style="border: none">
                    <asp:Button CssClass="buttonMaterials fontSizeSmaller" ID="btnViewMaterials" runat="server"
                        Text="申請資材" Visible="false" OnClientClick="viewMaterials();return false;"/>
                </td>
    
    
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);
    
            bool isHistory = false;
            if (Session[SESSION_KEY_IS_HISTORY] != null)
            {
                isHistory = (bool)Session[SESSION_KEY_IS_HISTORY];
                Session[SESSION_KEY_IS_HISTORY] = false;
            }
    
            this.ViewMenuButton(new StatusManager(hdnStatusNo.Value), isHistory);
            this.ViewControl(new StatusManager(hdnStatusNo.Value), isHistory);
    
            this.GenerateDrugAndProdJavaScript();
            this.GenerateApplicantJavaScript();
            this.GenerateSuperiorJavaScript();
            this.GenerateOldApplicationJavaScript();
            this.GenerateViewMaterials(hdnApplicationNo.Value);
            this.GenerateReportJavaScript();
    
            this.SetReadOnlyValue();
        }
    
    
        /// <summary>
        /// 申請資材用のスクリプトを生成する
        /// </summary>
        protected void GenerateViewMaterials(string applicationNo)
        {
            string materialsPath = ConfigurationManager.AppSettings["MaterialsReferencePath"];
    
            StringBuilder script = new StringBuilder();
            script.Append("<script type=text/javascript>");
            script.Append("function viewMaterials(){");
            script.Append("location.href = '");
            script.Append(materialsPath);
            script.Append("\\");
            script.Append(applicationNo);
            script.Append("';");
            script.Append("}");
            script.Append("</script>");
            Page.ClientScript.RegisterClientScriptBlock(typeof(string), "ViewMaterialsScript", script.ToString());
        }
    
  • 相关阅读:
    nginx日志格式配置
    shell入门(一)
    shell批量创建随机文件名格式文件
    Centos7 下安装配置tomcat7
    Linux安装VM虚拟化软件
    mysql初探
    java.lang.ClassNotFoundException: org.apache.commons.collections.FastHashMap
    HTTP Status 500 ? Internal Server Error
    如何使用Chrome浏览器查看网页的响应头
    Servlet的API
  • 原文地址:https://www.cnblogs.com/haiy/p/4060061.html
Copyright © 2020-2023  润新知