GridViewRow createChildRow(string requestId = "", ChildType childType = ChildType.WorkItem) { GridViewRow row = new GridViewRow(0, 0, DataControlRowType.DataRow, DataControlRowState.Selected); TableCell tableCell = null; try { row.CssClass = "gridBody"; row.Style["display"] = "none"; row.ID = string.Format("gridChild_{0}_{1}", requestId, childType.ToString()); row.Attributes.Add("requestId", requestId); row.Attributes.Add("childType", childType.ToString()); row.Attributes.Add("Name", string.Format("gridChild_{0}", requestId)); //add the table cells for (int i = 0; i < DCC.Count; i++) { tableCell = new TableCell(); tableCell.Text = " "; if (i == DCC.IndexOf("X")) { //set width to match parent tableCell.Style["width"] = "12px"; } else if (i == DCC.IndexOf("WORKREQUESTID")) { tableCell.Style["padding"] = "0px"; tableCell.Style["vertical-align"] = "top"; tableCell.ColumnSpan = DCC.Count - 1; //add the frame here tableCell.Controls.Add(createChildFrame(requestId: requestId, childType: childType)); } else { tableCell.Style["display"] = "none"; } row.Cells.Add(tableCell); } } catch (Exception ex) { LogUtility.LogException(ex); row = null; } return(row); }
HtmlIframe createChildFrame(string requestId = "", ChildType childType = ChildType.WorkItem) { HtmlIframe childFrame = new HtmlIframe(); if (string.IsNullOrWhiteSpace(requestId)) { return(null); } childFrame.ID = string.Format("frameChild_{0}_{1}", requestId, childType.ToString()); childFrame.Attributes.Add("requestId", requestId); childFrame.Attributes.Add("childType", childType.ToString()); childFrame.Attributes["frameborder"] = "0"; childFrame.Attributes["scrolling"] = "no"; childFrame.Attributes["src"] = "javascript:''"; childFrame.Style["height"] = "30px"; childFrame.Style["width"] = "100%"; childFrame.Style["border"] = "none"; return(childFrame); }
private void RenderViewer() { if (isRender) { return; } isRender = true; if (ActualHeight <= 0 || ActualWidth <= 0) { throw new ArgumentException($"未设置 {nameof (ActualHeight)} 或 {nameof (ActualWidth)}"); } var w = ActualWidth; var h = ActualHeight; ChildValue = new VisualWrapper(() => { if (!(Activator.CreateInstance(ChildType, Params) is FrameworkElement fe)) { return(new Grid()); } fe.Width = w; fe.Height = h; return(fe); }, ExtendsParentDataContext, ExtendsParentDataContext ? DataContext : null, AsyncRunName ?? ChildType.ToString()); Children.Add(ChildValue); }