/// <summary> /// 处理Data为DataResult /// </summary> /// <remarks> /// 处理Data为DataResult /// </remarks> /// <param name="dataSourceList">数据源集合</param> protected void TranDataSourceList(WordPrintDataSourceCollection dataSourceList) { for (int i = 0; i < dataSourceList.Count; i++) { dataSourceList[i].DataResult = WebControlUtility.GetDataSourceResult(this, dataSourceList[i].Data); } }
private void RenderEditorContainer(HtmlTextWriter writer) { HtmlGenericControl script = new HtmlGenericControl("script"); script.ID = EditorContainerClientID; script.Attributes["type"] = "text/plain"; if (Width != Unit.Empty) { script.Style["width"] = Width.ToString(); } else { script.Style["width"] = "800px"; } if (Height != Unit.Empty) { script.Style["height"] = Height.ToString(); } script.InnerHtml = this._InitialData; writer.Write(WebControlUtility.GetControlHtml(script)); }
/* private void MergeParameterItems(WfParameterNeedToBeCollected items, WfParameterNeedToBeCollected wfParameters) * { * foreach (WfParameterDescriptor item in wfParameters) * { * if (!items.ContainsKey(item.ParameterName)) * { * items.Add(item); * } * } * } */ private void CollectParameter(WfParameterDescriptor wfpd) { Control control = WebControlUtility.FindControlByID(this.Page, wfpd.ControlID, true); if (control != null) { //控件对象路径 string targetPro = string.Empty; //控件对象属性 string targetProName = wfpd.ControlPropertyName; DataBindingControl.SplitPath(control, wfpd.ControlPropertyName, out targetPro, out targetProName); //获取目标属性值 object targetItem = DataBindingControl.FindObjectByPath(control, targetPro); if (targetItem != null) { object targetValue = DataBindingControl.FindObjectByPath(targetItem, targetProName); Type realType = typeof(string); if (wfpd.ParameterType.TryToRealType(out realType)) { this.CurrentProcess.ApplicationRuntimeParameters[wfpd.ParameterName] = DataConverter.ChangeType(targetValue, realType); } } } }
protected override void InitDialogContent(Control container) { base.InitDialogContent(container); this.ID = "OpinionInputDialog"; Control opinionContainer = WebControlUtility.FindControlByHtmlIDProperty(container, "inputContainer", true); if (opinionContainer != null) { TextBox input = new TextBox(); input.ID = "OpinionInput"; input.TextMode = TextBoxMode.MultiLine; input.Width = Unit.Percentage(99); input.Height = Unit.Percentage(99); opinionContainer.Controls.Add(input); } HtmlInputHidden promptText = (HtmlInputHidden)WebControlUtility.FindControlByHtmlIDProperty(container, "promptText", true); if (promptText != null) { if (AllowEmptyOpinion) { promptText.Value = string.Empty; } else { promptText.Value = EmptyOpinionPrompt; } } }
private void InitAllAgreeWhenConsignCheckbox(Control checkbox) { if (checkbox != null) { bool visible = true; visible = (CurrentActivityDescriptor != null && AllowMultiUsers); this.allAgreeWhenConsignCheckbox = (HtmlInputCheckBox)checkbox; this.allAgreeWhenConsignCheckbox.Checked = GetAllAgreeWhenConsignCheckboxValue(); if (visible == false) { this.allAgreeWhenConsignCheckbox.Style["display"] = "none"; } HtmlGenericControl label = (HtmlGenericControl)WebControlUtility.FindControlByHtmlIDProperty(allAgreeWhenConsignCheckbox.Parent, "allAgreeWhenConsignLabel", true); if (label != null) { label.Attributes["for"] = allAgreeWhenConsignCheckbox.ClientID; if (visible == false) { label.Style["display"] = "none"; } } } }
private void RenderHtcInnerXml() { XmlDocument xmlDoc = XmlHelper.CreateDomDocument("<TabStrips/>"); XmlNode root = xmlDoc.DocumentElement; foreach (TabStripItem item in this.tabStrips) { XmlNode itemNode = XmlHelper.AppendNode(root, "TabStrip"); XmlHelper.AppendNotNullAttr(itemNode, "key", item.Key); XmlHelper.AppendNotNullAttr(itemNode, "image", item.Logo); XmlHelper.AppendNotNullAttr(itemNode, "text", item.Text); XmlHelper.AppendNotNullAttr(itemNode, "tag", item.Tag); XmlHelper.AppendNotNullAttr(itemNode, "width", item.Width.ToString()); if (string.IsNullOrEmpty(item.ControlID) == false) { Control panel = WebControlUtility.FindControlByID(this.Page, item.ControlID, true); if (panel != null) { XmlHelper.AppendNotNullAttr(itemNode, "elementID", panel.ClientID); } } } this.clientTabStrip.InnerHtml = root.OuterXml; }
/// <summary> /// Restores view-state information from a previous request that was saved with the SaveViewState method. /// 并在LoadViewState之前缓存ViewState中所有IStateManager类型项 /// 以及在LoadViewState之后从缓存中恢复将ViewState中ViewSateItemInternal类型项恢复成IStateManager类型项 /// </summary> /// <param name="savedState">表示要还原的控件状态的 Object</param> /// <remarks> /// Restores view-state information from a previous request that was saved with the SaveViewState method. /// 并在LoadViewState之前缓存ViewState中所有IStateManager类型项 /// 以及在LoadViewState之后从缓存中恢复将ViewState中ViewSateItemInternal类型项恢复成IStateManager类型项 ///</remarks> protected override void LoadViewState(object savedState) { base.LoadViewState(savedState); StateBag backState = WebControlUtility.PreLoadViewState(ViewState); WebControlUtility.AfterLoadViewState(ViewState, backState); }
protected override void OnPagePreRenderComplete(object sender, EventArgs e) { if (CurrentMode == ControlShowingMode.Dialog) { InitActivitiesListBox(_ActivitiesList); InitOpinionInputControl(); HtmlTableRow reasonList = (HtmlTableRow)WebControlUtility.FindControlByHtmlIDProperty(this, "reasonList", true); if (reasonList != null) { if (this.Reasons.Count > 0) { reasonList.Style["display"] = "inline"; HtmlSelect resonSelector = (HtmlSelect)WebControlUtility.FindControlByHtmlIDProperty(this, "resonSelector", true); if (resonSelector != null) { foreach (var reason in this.Reasons) { resonSelector.Items.Add(new ListItem(reason.Description, reason.Key)); } } } } } base.OnPagePreRenderComplete(sender, e); }
private void RenderRoleMatrixEntry(HtmlTextWriter writer) { if (this.RoleID.IsNotEmpty()) { HtmlGenericControl container = new HtmlGenericControl("div"); container.Controls.Add(CreateLinkButton(GetEditPropertiesUrl(), "_ppt", EditPropertiesImgUrl, Translator.Translate(Define.DefaultCulture, this.Enabled ? "编辑矩阵属性" : string.Empty), GetEditPropertiesLinkScript())); bool exsits = false; HaveExtendedPropertiesRoleIDs.TryGetValue(this.RoleID, out exsits); if (exsits) { container.Controls.Add(CreateLinkButton(GetEditMatrixUrl(), "_mtx", EditMatrixImgUrl, Translator.Translate(Define.DefaultCulture, this.Enabled ? "编辑矩阵属性" : "存在矩阵属性定义"), GetEditMatrixLinkScript())); } writer.Write(WebControlUtility.GetControlHtml(container)); } }
protected override void InitDialogContent(Control container) { base.InitDialogContent(container); this.ID = "userSelectorDialog"; HtmlForm form = (HtmlForm)WebControlUtility.FindParentControl(this, typeof(HtmlForm), true); if (form != null) { form.Style["width"] = "100%"; form.Style["height"] = "100%"; } this.Width = Unit.Percentage(100); this.Height = Unit.Percentage(100); InitUserInputControl(WebControlUtility.FindControlByHtmlIDProperty(container, "userInputContainer", true)); if (this.IsConsign) { InitConsignTypeSelector(WebControlUtility.FindControlByHtmlIDProperty(container, "consignTypeContainer", true)); InitSequenceTypeSelector(WebControlUtility.FindControlByHtmlIDProperty(container, "sequenceTypeContainer", true)); } }
private void serverConfirmButton_Click(object sender, EventArgs e) { try { if (this.processGrid != null) { List <WorkflowInfo> processInfoList = new List <WorkflowInfo>(); foreach (string key in this.processGrid.SelectedKeys) { IWfProcess process = WfRuntime.GetProcessByProcessID(key); var processInfo = WorkflowInfo.ProcessAdapter(process); processInfoList.Add(processInfo); } HtmlInputHidden resultData = (HtmlInputHidden)WebControlUtility.FindControlByID(this, "resultData", true); if (resultData != null) { resultData.Value = JSONSerializerExecute.Serialize(processInfoList); } ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "Close", string.Format("window.returnValue = $get('{0}').value; top.close()", resultData.ClientID), true); } } catch (System.Exception ex) { string errorScript = WebUtility.GetShowClientErrorScript(ex.Message, ex.StackTrace, "错误"); ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "ShowError", "SubmitButton.resetAllStates();" + errorScript, true); } }
/// <summary> /// Saves any state that was modified after the TrackViewState method was invoked /// 在SaveViewState之前,将ViewState中所有IStateManager类型项转换为可序列化的ViewSateItemInternal类型项 /// 以及在SaveViewState之后,将ViewState中所有ViewSateItemInternal类型项恢复成IStateManager类型项 /// </summary> /// <returns>返回服务器控件的当前视图状态</returns> /// <remarks> /// Saves any state that was modified after the TrackViewState method was invoked /// 并在SaveViewState之前,将ViewState中所有IStateManager类型项转换为可序列化的ViewSateItemInternal类型项 /// 以及在SaveViewState之后,将ViewState中所有ViewSateItemInternal类型项恢复成IStateManager类型项 /// </remarks> protected override object SaveViewState() { WebControlUtility.PreSaveViewState(ViewState); object o = base.SaveViewState(); WebControlUtility.AfterSavedViewState(ViewState); return(o); }
/// <summary> /// 初始化对话框内容 /// </summary> /// <param name="container"></param> protected override void InitDialogContent(Control container) { base.InitDialogContent(container); this.ID = "RejectActivitySelector"; _ActivitiesList = (HtmlSelect)WebControlUtility.FindControlByHtmlIDProperty(container, "activitiesList", true); }
/// <summary> /// 初始化对话框内容 /// </summary> /// <param name="container"></param> protected override void InitDialogContent(Control container) { base.InitDialogContent(container); this.ID = "PredefinedOpinionDialog"; _OpinionText = (HtmlTextArea)WebControlUtility.FindControlByHtmlIDProperty(container, "opinionText", true); InitOpinionInputBox(_OpinionText); }
/// <summary> /// UEditor在Submit的时候,会自动创建一个TextArea,将导致ASP.net的页面检查不过(含有Html Tag)。 /// 因此先渲染一个同ID的SPAN。SPAN和TextArea不同,不会Post的。 /// </summary> /// <param name="writer"></param> private void RenderFakeElement(HtmlTextWriter writer) { HtmlGenericControl span = new HtmlGenericControl("span"); span.ID = "ueditor_textarea_" + this.PostedDataFormName; span.Attributes["name"] = this.PostedDataFormName; span.Style["display"] = "none"; writer.Write(WebControlUtility.GetControlHtml(span)); }
private TControl DealChildControl <TControl>(Control template, Type childControlType, InitControlDelegate <TControl> initDelegate) where TControl : Control { TControl ctrl = (TControl)WebControlUtility.FindControl(this.Page, typeof(HtmlHead), true); if (ctrl != null && initDelegate != null) { initDelegate(ctrl); } return(ctrl); }
private TControl DealChildControl <TControl>(Control template, string controlID, InitControlDelegate <TControl> initDelegate) where TControl : Control { TControl ctrl = (TControl)WebControlUtility.FindControlByHtmlIDProperty(template, controlID, true); if (ctrl != null && initDelegate != null) { initDelegate(ctrl); } return(ctrl); }
private void InitOpinionInputControl() { HtmlGenericControl opinionBody = (HtmlGenericControl)WebControlUtility.FindControlByHtmlIDProperty(this, "opinionBody", true); if (opinionBody != null) { if (ShowOpinionInput) { opinionBody.Style["display"] = "inline"; } } }
private static string GetAllAssigneesStatusHtmlWithoutPresence(WfProcessCurrentInfo atp) { HtmlGenericControl span = new HtmlGenericControl("span"); foreach (var assignee in atp.Assignees) { span.InnerHtml = string.Format("{0}({1})", HttpUtility.HtmlEncode(assignee.User.DisplayName), HttpUtility.HtmlEncode(assignee.User.TopOU.DisplayName)); } return(WebControlUtility.GetControlHtml(span)); }
private void RenderIframe(HtmlTextWriter writer) { StringBuilder sbIframeHtml = new StringBuilder(); sbIframeHtml.Append("<iframe style=\"display:block;position:absolute;z-index:1000\"></iframe>"); LiteralControl iframe = new LiteralControl(sbIframeHtml.ToString()); //iframe.Style["display"] = "none"; //iframe.Style["position"] = "absolute"; //iframe.Style["z-index"] = "1000"; writer.Write(WebControlUtility.GetControlHtml(iframe)); }
private void InitCirculateControls(Control container) { Control circulateRow = WebControlUtility.FindControlByHtmlIDProperty(container, "circulateRow", true); if (circulateRow != null) { circulateRow.Visible = this.ShowCirculateUsers; } if (this.ShowCirculateUsers) { InitCirculateUserInput(WebControlUtility.FindControlByHtmlIDProperty(container, "circulateContainer", true)); } }
/// <summary> /// 验证服务器端控件集合 /// </summary> /// <param name="controls"></param> /// <param name="controls_key">选择指定的字段进行验证</param> /// <returns></returns> public Validator Validate(Control[] controls, params string[] controls_key) { IDictionary <string, object> dict = new Dictionary <string, object>(); IDictionary <string, object> allDict = WebControlUtility.GetAllValue(controls); foreach (string req_key in controls_key) { if (allDict.ContainsKey(req_key)) { dict.Add(req_key, allDict[req_key]); } } return(Validate(dict)); }
protected override void InitDialogContent(Control container) { base.InitDialogContent(container); this.ID = "ServiceImportDialog"; HtmlForm form = (HtmlForm)WebControlUtility.FindParentControl(this, typeof(HtmlForm), true); if (form != null) { form.Style["width"] = "100%"; form.Style["height"] = "100%"; } this.DialogTitle = "ServiceImport"; this.Width = Unit.Percentage(100); this.Height = Unit.Percentage(100); InitChildControls(container); }
protected override void InitDialogContent(Control container) { base.InitDialogContent(container); this.ID = "ImageUploaderDialog"; HtmlForm form = (HtmlForm)WebControlUtility.FindParentControl(this, typeof(HtmlForm), true); if (form != null) { form.Style["width"] = "100%"; form.Style["height"] = "100%"; } this.DialogTitle = "上传图片"; this.Width = Unit.Percentage(100); this.Height = Unit.Percentage(100); InitChildControls(WebControlUtility.FindControlByHtmlIDProperty(container, "imageUploader_container", true)); }
/// <summary> /// 判断是否只是输出本控件,如果是则进行只输出本控件处理,否则进行正常的控件输出 /// </summary> /// <param name="writer">接收控件内容的 HtmlTextWriter 对象。</param> public override void RenderControl(HtmlTextWriter writer) { if (this.RenderMode.OnlyRenderSelf && !this.RenderMode.UseNewPage) { StringBuilder strB = new StringBuilder(); StringWriter sw = new StringWriter(strB); using (HtmlTextWriter baseWriter = new HtmlTextWriter(sw)) { base.RenderControl(baseWriter); } WebControlUtility.RenderControlOnlySelf(this, strB.ToString(), this.RenderMode); } else { base.RenderControl(writer); } }
protected override void InitDialogContent(Control container) { this.rootContainer = container; base.InitDialogContent(container); container.Controls.Add(this.tree); HtmlForm form = (HtmlForm)WebControlUtility.FindParentControl(this, typeof(HtmlForm), true); if (form != null) { form.Style["width"] = "100%"; form.Style["height"] = "100%"; } this.Width = Unit.Percentage(100); this.Height = Unit.Percentage(100); }
protected override void InitDialogContent(Control container) { this.Page.EnableViewState = false; base.InitDialogContent(container); this.ID = "activityEditorDialog"; actName = (HtmlInputText)WebControlUtility.FindControlByHtmlIDProperty(container, "actName", true); if (this.Operation == "update" && CurrentActivityDescriptor != null) { actName.Value = CurrentActivityDescriptor.Name; } InitAllAgreeWhenConsignCheckbox(WebControlUtility.FindControlByHtmlIDProperty(container, "allAgreeWhenConsignCheckbox", true)); InitVariableRow(WebControlUtility.FindControlByHtmlIDProperty(container, "variableRow", true)); InitVariableCheckBoxes(WebControlUtility.FindControlByHtmlIDProperty(container, "variableList", true)); InitUserInputArea(container); }
private void RenderStatus(WfProcessCurrentInfoCollection atpc, UserIMAddressCollection extendInfo, HtmlTextWriter writer) { WfProcessCurrentInfo atp = null; if (this.ProcessID.IsNotEmpty()) { atp = atpc.Find(a => string.Compare(a.InstanceID, this.ProcessID, true) == 0); } else { if (this.ResourceID.IsNotEmpty()) { atp = atpc.Find(a => string.Compare(a.ResourceID, this.ResourceID, true) == 0); } } if (atp != null) { writer.Write(WebControlUtility.GetControlHtml(CreateStatusDisplayControl(atp, extendInfo))); } }
private void InitOpinionInoutControl() { HtmlTableCell userInputCell = (HtmlTableCell)WebControlUtility.FindControlByHtmlIDProperty(this, "userInputCell", true); if (userInputCell != null) { if (ShowOpinionInput) { userInputCell.Style["height"] = "64px"; } } HtmlGenericControl opinionBody = (HtmlGenericControl)WebControlUtility.FindControlByHtmlIDProperty(this, "opinionBody", true); if (opinionBody != null) { if (ShowOpinionInput) { opinionBody.Style["display"] = "inline"; } } }
private void InitChildControls(Control container) { Control addressDiv = WebControlUtility.FindControlByHtmlIDProperty(container, "div_serviceImport_serviceAddress", true); if (addressDiv != null) { this._ddlServiceAddress.Items.Clear(); this._ddlServiceAddress.Style["width"] = "300px"; this._ddlServiceAddress.Attributes.Add("onchange", "bindOperation()"); this._ddlServiceAddress.DataSource = WfGlobalParameters.Default.ServiceAddressDefs; this._ddlServiceAddress.DataTextField = "Address"; this._ddlServiceAddress.DataValueField = "Key"; this._ddlServiceAddress.DataBind(); addressDiv.Controls.Add(this._ddlServiceAddress); } Control operationDiv = WebControlUtility.FindControlByHtmlIDProperty(container, "div_serviceImport_serviceOperation", true); if (operationDiv != null && !string.IsNullOrEmpty(this._ddlServiceAddress.SelectedValue)) { this._ddlServiceOperation.Items.Clear(); this._ddlServiceOperation.Style["width"] = "300px"; this._ddlServiceOperation.Attributes.Add("onchange", "analysisResult()"); try { this._ddlServiceOperation.DataSource = GetOperationList(this._ddlServiceAddress.SelectedValue); } catch { } this._ddlServiceOperation.DataBind(); this._ddlServiceOperation.Items.Insert(0, new ListItem() { Selected = true, Text = "请选择", Value = "" }); operationDiv.Controls.Add(this._ddlServiceOperation); } }