- A+
所属分类:.NET技术
namespace SM8016CPDLMXQD { public class SM8016CPDLMXQD : ISuwfBus { private SlnSuwfPage _page; public void Initial(SlnSuwfPage page) { _page = page; BindButtonEvent("btnCPDLMXQD", new EventHandler(BtnCPDLMXQD_Click), ""); } #region 绑定控件事件 BindButtonEvent private void BindButtonEvent(string strBtnName, EventHandler ev, string strText) { Control crl = _page.FindControl(strBtnName); if (crl == null) { return; } Button btn = (Button)crl; if (btn == null) { return; } btn.Click += ev; if (strText != "") btn.Attributes.Add("onclick", "javascript:if(!confirm('" + strText + "?')){return false;}"); } #endregion #region BtnCPDLMXQD_Click private void BtnCPDLMXQD_Click(object sender, EventArgs e) { #region int rowNum = -1; string ID = _page.GetControlValue("val_ID2"); if (string.IsNullOrEmpty(ID)) { _page.ClientScript.RegisterStartupScript(_page.GetType(), "ID2", SlnString.ScriptAlertMessage("ID2不为空")); return; } #region for (int j = 0; j < _page.GridData.Rows.Count; j++) { if (_page.GetRowDataByKey(j, "ID") == ID) { rowNum = j; break; } } #endregion string mfstr = "<script language='javascript'>n"; mfstr += "var varReturn = window.showModalDialog('CommSelect.aspx?PU=8024&MW_ID=2',null," + "'dialogLeft:300px;dialogTop:50px;dialogWidth:1000px;dialogHeight:800px;edge:raised;resizable:yes;help:off;status:off;scroll:off');n"; mfstr += @" if (varReturn != null && varReturn != '') { var sarray = new Array(); sarray = varReturn.split(';;'); for (var i = 0; i < sarray.length; i++) { var childSarray = new Array(); childSarray = sarray[i].split(',,'); if ((childSarray.length == 2) && (childSarray[0] == 'ID')) { document.all.val_CPDLMXID.value=childSarray[1]; $(""td[colname='CPDLMXID']"").eq(" + rowNum.ToString() + @").find('input').val(childSarray[1]); } } }"; mfstr += "</script>n"; if (!_page.ClientScript.IsClientScriptBlockRegistered("zujs_script1")) { _page.ClientScript.RegisterStartupScript(_page.GetType(), "zujs_script1", mfstr); } _page.SetGridCellModified(rowNum, "CPDLMXID"); _page.SetGridRowSelected(rowNum, true); return; #endregion } #endregion } }