动态生成JS
private void GenerateDrugAndProdJavaScript() { StringBuilder script = new StringBuilder(); script.Append("<script type=text/javascript>"); script.Append("function selectDrugAndProd(){"); script.Append("var drug = document.getElementById(‘" + hdnDrug.ClientID + "‘).value;"); script.Append("var productList = document.getElementById(‘" + hdnProduct.ClientID + "‘).value;"); script.Append("result = showModalDialogDisplay(‘../Dialog/DrugProdSelect.aspx?" + ConstValue.QUERY_STRING_KEY_SELECTED_DRUG_CODE + "=‘ + drug + ‘" + "&" + ConstValue.QUERY_STRING_KEY_SELECTED_PRODUCT_CODES + "=‘ + productList" + ", null, 650, 400);"); script.Append("if(result != null && typeof(result) == ‘object‘) {"); script.Append("document.getElementById(‘" + hdnDrug.ClientID + "‘).value = result[0];"); script.Append("document.getElementById(‘" + txtDrug.ClientID + "‘).value = result[1];"); script.Append("document.getElementById(‘" + hdnDrugName.ClientID + "‘).value = result[1];"); script.Append("document.getElementById(‘" + hdnProduct.ClientID + "‘).value = result[3];"); script.Append("document.getElementById(‘" + txtProduct.ClientID + "‘).value = result[4];"); script.Append("document.getElementById(‘" + hdnProductName.ClientID + "‘).value = result[4];"); script.Append("}"); script.Append("}"); script.Append("</script>"); Page.ClientScript.RegisterClientScriptBlock(typeof(string), "DrugAndProdJavaScript", script.ToString()); }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。