HtmlIframe createChildFrame(string itemId = "") { HtmlIframe childFrame = new HtmlIframe(); if (string.IsNullOrWhiteSpace(itemId)) { return(null); } childFrame.ID = string.Format("frameChild_{0}", itemId); switch (_currentLevel) { case 0: childFrame.Attributes.Add("ProductVersionID", itemId); break; case 1: childFrame.Attributes.Add("CONTRACTID", itemId); break; case 2: childFrame.Attributes.Add("Narrative_CONTRACTID", itemId); break; } 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); }
/// <summary> /// Imprimi o relatório. /// </summary> /// <param name="report">Relatório a ser impresso.</param> /// <param name="frame">Frame onde será exibido a imporessão.</param> public static void View(LocalReport report, HtmlIframe frame) { Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; /* * ////The DeviceInfo settings should be changed based on the reportType * string deviceInfo = @"<DeviceInfo> * <ColorDepth>32</ColorDepth> * <DpiX>96</DpiX> * <DpiY>96</DpiY> * <OutputFormat>PDF</OutputFormat> * <PageWidth>8.27in</PageWidth> * <PageHeight>11.69in</PageHeight> * <MarginTop>0in</MarginTop> * <MarginLeft>0in</MarginLeft> * <MarginRight>0in</MarginRight> * <MarginBottom>0in</MarginBottom> * </DeviceInfo>"; */ byte[] bytes = report.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings); CacheHelper.AddToUser <byte[]>("PDF_TO_PRINT", bytes, 1); frame.Attributes["src"] = VirtualPathUtility.ToAbsolute("~/") + "PDFViewer.aspx"; }
protected void Page_Load(object sender, EventArgs e) { try { foreach (var Pageitem in this.Controls) { if (Pageitem.GetType() == typeof(HtmlForm)) { foreach (var HtmlFormitem in ((HtmlForm)Pageitem).Controls) { //if (HtmlFormitem.GetType() == typeof(HtmlIframe)) //{ // ((HtmlIframe)HtmlFormitem).Src = "home/index"; //} if (HtmlFormitem.GetType() == typeof(ContentPlaceHolder)) { foreach (var ContentPlaceHolderitem in ((ContentPlaceHolder)HtmlFormitem).Controls) { if (ContentPlaceHolderitem.GetType() == typeof(HtmlIframe)) { holder = (HtmlIframe)ContentPlaceHolderitem; } } } } } } } catch (Exception) { } }
public void IframeDownload(LinkButton lnkDownloadB, string FilePath, HtmlIframe iframeControl, Page page) { lnkDownloadB.CommandArgument = FilePath; lnkDownloadB.Text = "Not downloading? Try again by clicking here."; iframeControl.Src = "~/Download.aspx"; var openDownloadModal = new JSUtility("modalDownload"); openDownloadModal.ModalShow(page); }
//public Panel RenderProjectImage() //{ // Panel generalPanel = new Panel(); // foreach (VIva2DataAccess.Images item in _projectImages) // { // Byte[] bytes = (Byte[])item.Data; // Image img = new Image(); // img.ImageUrl = "data:image/png;base64," + Convert.ToBase64String(bytes); // img.CssClass = (imagesSize == "small") ? "img-responsive noMargins" : "img-responsive"; ; // img.ImageUrl = _project.ImagePath; // img.Width = (imagesSize == "small") ? 100 : 250; // img.Height = (imagesSize == "small") ? 100 : 250; // generalPanel.Controls.Add(img); // } // if (editMode) // { // FileUpload uploadInput = new FileUpload(); // uploadInput.ID = "photo-upload"; // generalPanel.Controls.Add(uploadInput); // Image uploadedImage = new Image(); // uploadedImage.ID = "img"; // uploadedImage.Height = (imagesSize == "small") ? 100 : 250; // generalPanel.Controls.Add(uploadedImage); // TextBox path = new TextBox(); // path.ID = "b64"; // generalPanel.Controls.Add(path); // } // return generalPanel; //} public HtmlIframe RenderProjectVideo() { HtmlIframe vid = new HtmlIframe(); vid.Src = _project.Video; vid.Attributes["width"] = "100%"; vid.Attributes["height"] = "315"; vid.Attributes["frameborder"] = "0"; vid.Attributes["allowfullscreen"] = "allowfullscreen"; return(vid); }
/// <summary> /// Imprimi o relatório. /// </summary> /// <param name="report">Relatório a ser impresso.</param> /// <param name="frame">Frame onde será exibido a imporessão.</param> public static void Print(LocalReport report, HtmlIframe frame) { Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; byte[] bytes = report.Render("PDF", null, out mimeType, out encoding, out extension, out streamids, out warnings); CacheHelper.AddToUser <byte[]>("PDF_TO_PRINT", StreamPrintPdf(bytes), 1); frame.Attributes["src"] = VirtualPathUtility.ToAbsolute("~/") + "PDFViewer.aspx"; }
private void LoadMyrtille(HtmlIframe iframe, string url, bool focus) { // myrtille uses a cookie to store and retrieve the iframe's url once it's set for the iframe's http session // if it was just using the url given in parameter, the iframe's http session would be regenerated each time the portal is reloaded (because it uses "cookieless=UseUri" session state), // which would trigger a new connection if (Request.Cookies[iframe.ClientID] == null) { var connectionInfo = new ConnectionInfo { User = new UserInfo { UserName = "******", Password = "******" }, Host = new HostInfo { IPAddress = "1.2.3.4", }, AllowRemoteClipboard = true, AllowFileTransfer = false, AllowPrintDownload = true, AllowAudioPlayback = true, MaxActiveGuests = 2 }; var connectionId = connectionClient.GetConnectionId(connectionInfo); // save the connection id used for the myrtille iframe // it will be needed for any call to the myrtille API (screenshot, etc.) var cookie = new HttpCookie(string.Format("{0}_cid", iframe.ClientID)); cookie.Value = connectionId.ToString(); cookie.Path = "/"; Response.Cookies.Add(cookie); iframe.Src = url + "?cid=" + connectionId + "&__EVENTTARGET=&__EVENTARGUMENT=&connect=Connect%21"; } else { iframe.Src = Request.Cookies[iframe.ClientID].Value + "?fid=" + iframe.ClientID; } if (focus) { iframe.Attributes["onload"] = "this.contentWindow.focus();"; } }
private void LoadMyrtille(HtmlIframe iframe, string url, ConnectionInfo connectionInfo, bool focus) { try { // myrtille uses a cookie to store and retrieve the iframe's url once it's set for the iframe's http session // if it was just using the url given in parameter, the iframe's http session would be regenerated each time the portal is reloaded (because it uses "cookieless=UseUri" session state), // which would trigger a new connection if (Request.Cookies[iframe.ClientID] == null) { connectionInfo.GatewayUrl = url; var connectionId = connectionClient.GetConnectionId(connectionInfo); // save the connection id used for the myrtille iframe // it will be needed for any call to the myrtille API (screenshot, etc.) var cookie = new HttpCookie(string.Format("{0}_cid", iframe.ClientID)); cookie.Value = connectionId.ToString(); cookie.Path = "/"; Response.Cookies.Add(cookie); // also save the gateway url used for the myrtille iframe // it's stored and thus could be retrieved from the connection info, but GetConnectionInfo is protected against subsequent calls cookie = new HttpCookie(string.Format("{0}_url", iframe.ClientID)); cookie.Value = url; cookie.Path = "/"; Response.Cookies.Add(cookie); iframe.Src = url + "?cid=" + connectionId + "&__EVENTTARGET=&__EVENTARGUMENT=&connect=Connect%21"; } else { iframe.Src = Request.Cookies[iframe.ClientID].Value + "?fid=" + iframe.ClientID; } if (focus) { iframe.Attributes["onload"] = "this.contentWindow.focus();"; } } catch (Exception exc) { System.Diagnostics.Trace.TraceError("failed to load myrtille iframe {0} ({1})", iframe.ClientID, exc); } }
HtmlIframe createChildFrame(string itemId = "") { HtmlIframe childFrame = new HtmlIframe(); if (string.IsNullOrWhiteSpace(itemId)) { return(null); } childFrame.ID = string.Format("frameChild_{0}", itemId); childFrame.Attributes.Add("systemId", itemId); 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); }
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 pintarDocumentos() { //HyperLink hyperLinkDocumento; Panel pane; HtmlIframe iframe; DataTable dt = new DataTable(); BL_Documento blDocumento = new BL_Documento(); dt = blDocumento.BL_ObtenerDocumentosActivos(); for (int i = 0; i < dt.Rows.Count; i++) { pane = new Panel(); pane.CssClass = "source"; iframe = new HtmlIframe(); iframe.Attributes["height"] = "750px"; iframe.Attributes["width"] = "500px"; iframe.Style["left"] = "50%"; iframe.Style["margin-left"] = "25%"; iframe.Src = dt.Rows[i]["ruta_documento"].ToString(); //iframe.InnerHtml = dt.Rows[i]["ruta_documento"].ToString(); pane.Controls.Add(iframe); /******************************************************************************/ /* * hyperLinkDocumento = new HyperLink(); * hyperLinkDocumento.Target = "_blank"; * hyperLinkDocumento.NavigateUrl = dt.Rows[i]["ruta_documento"].ToString(); * hyperLinkDocumento.Text = dt.Rows[i]["nombre_documento"].ToString(); * * pane.Controls.Add(hyperLinkDocumento); */ this.MyContent.Controls.Add(pane); } }
/// <summary> /// Imprimi o relatório. /// </summary> /// <param name="report">Relatório a ser impresso.</param> /// <param name="frame">Frame onde será exibido a imporessão.</param> public static void Download(LocalReport report, HtmlIframe frame, RenderType renderType) { string extension = string.Empty; string mimeType = string.Empty; Warning[] warnings; string[] streamids; string encoding; switch (renderType) { case RenderType.PDF: extension = "pdf"; mimeType = "application/pdf"; break; case RenderType.Excel: extension = "xls"; mimeType = "application/vnd.excel"; break; case RenderType.Image: extension = "emf"; mimeType = "application/image"; break; default: throw new Exception("Unrecognized type: " + renderType + ". Type must be PDF, Excel or Image."); } byte[] bytes = report.Render(renderType.ToString(), null, out mimeType, out encoding, out extension, out streamids, out warnings); CacheHelper.AddToUser <string>("PDF_TO_PRINT_EXTENSION", extension, 1); CacheHelper.AddToUser <string>("PDF_TO_PRINT_MIMETYPE", "application/octet-stream", 1); CacheHelper.AddToUser <byte[]>("PDF_TO_PRINT", bytes, 1); frame.Attributes["src"] = VirtualPathUtility.ToAbsolute("~/") + "PDFViewer.aspx"; }
private void DoMagicNaAkciji() { DataTable dt = new DataTable(); if (ViewState["AkcijaTable"] == null) { SqlConnection con = new SqlConnection(conString); string jeilinije = "je"; SqlCommand com = new SqlCommand("SELECT [idProizvod], [Naziv], [Opis], [Cijena], [NazFile], [Tezina], [Countity] FROM [Proizvodi] WHERE [Akcija] LIKE @je", con); com.Parameters.AddWithValue("@je", jeilinije); con.Open(); SqlDataAdapter adptr = new SqlDataAdapter(com); adptr.Fill(dt); con.Close(); ViewState["AkcijaTable"] = dt; } else { dt = (DataTable)ViewState["AkcijaTable"]; } HtmlGenericControl mainDiv = new HtmlGenericControl(); mainDiv.Attributes["class"] = "row"; mainDiv.Style.Add("margin-left", "1%"); mainDiv.Style.Add("margin-right", "1%"); mainDiv.TagName = "div"; HtmlGenericControl subMainAkcija = new HtmlGenericControl(); subMainAkcija.Attributes["class"] = "col-lg-6 col-md-8 col-sm-12"; subMainAkcija.TagName = "div"; HtmlGenericControl subAkcija = new HtmlGenericControl(); subAkcija.Attributes["class"] = "row"; subAkcija.Style.Add("width", "100%"); subAkcija.TagName = "div"; HtmlGenericControl commerce = new HtmlGenericControl("div"); commerce.Attributes["class"] = "commerce"; HtmlGenericControl naAkciji = new HtmlGenericControl("div"); naAkciji.Attributes["class"] = "col-lg-12"; HtmlGenericControl paraNaAkc = new HtmlGenericControl("p"); paraNaAkc.Attributes["class"] = "cart-empty"; paraNaAkc.InnerText = "PROIZVODI NA AKCIJI"; paraNaAkc.Style.Add("color", "#764069"); naAkciji.Controls.Add(paraNaAkc); commerce.Controls.Add(naAkciji); subAkcija.Controls.Add(commerce); for (int i = 0; i < dt.Rows.Count; i++) { HtmlGenericControl itemDiv = new HtmlGenericControl(); itemDiv.Attributes["class"] = "col-lg-4 col-md-4 col-sm-6"; itemDiv.TagName = "div"; HtmlAnchor itemAnchor = new HtmlAnchor(); itemAnchor.ID = "anchorAkcija_" + dt.Rows[i].ItemArray[0]; itemAnchor.Attributes["class"] = "thumbnail"; // košarica akcija style itemAnchor.Style.Add("background", "#F2EFEC"); itemAnchor.Style.Add("border-color", "#F2EFEC"); itemAnchor.Style.Add("color", "#5E3354"); itemAnchor.CausesValidation = false; itemAnchor.ServerClick += ItemAnchor_ServerClick; HtmlImage itemImage = new HtmlImage(); itemImage.Src = "Images/" + dt.Rows[i].ItemArray[4]; HtmlContainerControl para = new HtmlGenericControl("h4"); para.InnerText = dt.Rows[i].ItemArray[1].ToString().ToUpper(); HtmlGenericControl Div = new HtmlGenericControl(); Div.TagName = "div"; //ImageButton imgBtn = new ImageButton(); //imgBtn.ID = "akcija_" + i; //imgBtn.ImageUrl = "~/Images/icones/add_to_cart_purple.png"; //imgBtn.Width = 20; //imgBtn.Click += AddToCart_ServerClick; //imgBtn.CausesValidation = false; HtmlGenericControl commerce11 = new HtmlGenericControl("div"); commerce11.Attributes["class"] = "commerce"; HtmlGenericControl paraNew = new HtmlGenericControl("p"); paraNew.Attributes["class"] = "return-to-shop"; HtmlButton btnTbody = new HtmlButton(); btnTbody.ID = "akcija_" + i; btnTbody.Attributes["class"] = "button glyphicon glyphicon-shopping-cart"; btnTbody.Attributes.Add("runat", "server"); btnTbody.Style.Add("color", "#F1C13C"); btnTbody.Style.Add("border-color", "#F1C13C"); btnTbody.CausesValidation = false; btnTbody.ServerClick += AddToCart_ServerClick; paraNew.Controls.Add(btnTbody); commerce11.Controls.Add(paraNew); commerce11.Style.Add("float", "left"); HtmlContainerControl para1 = new HtmlGenericControl("h4"); para1.Style.Add("float", "right"); para1.InnerText = dt.Rows[i].ItemArray[3] + " kn"; Div.Controls.Add(commerce11); Div.Controls.Add(para1); itemAnchor.Controls.Add(Div); itemAnchor.Controls.Add(itemImage); itemAnchor.Controls.Add(para); itemDiv.Controls.Add(itemAnchor); subAkcija.Controls.Add(itemDiv); } subMainAkcija.Controls.Add(subAkcija); mainDiv.Controls.Add(subMainAkcija); HtmlGenericControl subMainMap = new HtmlGenericControl(); subMainMap.Attributes["class"] = "col-lg-6 col-md-8 col-sm-12"; subMainMap.TagName = "div"; HtmlGenericControl subMap = new HtmlGenericControl(); subMap.Attributes["class"] = "row col-lg-12"; subMap.TagName = "div"; HtmlIframe mapIFrame = new HtmlIframe(); mapIFrame.Src = "https://www.google.com/maps/embed?pb=!1m18!1m12!1m3!1d2783.15947314275!2d15.93905251556764!3d45.76799417910569!2m3!1f0!2f0!3f0!3m2!1i1024!2i768!4f13.1!3m3!1m2!1s0x4765d43ba34f8727%3A0xe97ed758c57f65b!2sMarita+Market!5e0!3m2!1shr!2shr!4v1504394070429"; mapIFrame.Style.Add("border-style", "none"); mapIFrame.Style.Add("width", "100%"); mapIFrame.Style.Add("height", "500px"); subMap.Controls.Add(mapIFrame); subMainMap.Controls.Add(subMap); mainDiv.Controls.Add(subMainMap); Panel1.Controls.Add(mainDiv); }
protected void CreateControls(Control container, Guid entityId) { // Add a placeholder element with the control ID that will always be present, so // that any potential cell label will still have an control to associate with. var placeholder = new PlaceHolder { ID = Metadata.ControlID }; container.Controls.Add(placeholder); var context = CrmConfigurationManager.CreateContext(ContextName, true); var quickForm = Metadata.QuickForm.QuickFormIds.FirstOrDefault(); if (quickForm == null) { return; } var filterExpression = new FilterExpression(); filterExpression.Conditions.Add(new ConditionExpression("formid", ConditionOperator.Equal, quickForm.FormId)); var systemForm = Xrm.Metadata.OrganizationServiceContextExtensions.GetMultipleSystemFormsWithAllLabels(filterExpression, context).FirstOrDefault(); if (systemForm == null) { ADXTrace.Instance.TraceError(TraceCategory.Application, string.Format("Quick Form: A form with ID='{0}' could not be found.".FormatWith(quickForm.FormId))); return; } var formName = systemForm.GetAttributeValue <string>("name"); if (string.IsNullOrWhiteSpace(formName)) { ADXTrace.Instance.TraceError(TraceCategory.Application, string.Format("Quick Form: Form with ID='{0}' does not have a name.".FormatWith(quickForm.FormId))); return; } var templatePath = GetPortalQuickFormTemplatePath(ContextName); if (string.IsNullOrWhiteSpace(templatePath)) { ADXTrace.Instance.TraceError(TraceCategory.Application, "Failed to retrieve Quick Form template path."); return; } var iframe = new HtmlIframe { ID = Metadata.ControlID, Src = "about:blank" }; iframe.Attributes.Add("class", "quickform"); iframe.Attributes.Add("data-path", templatePath); iframe.Attributes.Add("data-controlid", Metadata.ControlID); iframe.Attributes.Add("data-formname", formName); iframe.Attributes.Add("data-lookup-element", Metadata.DataFieldName); container.Controls.Remove(placeholder); container.Controls.Add(iframe); var primaryKeyAttributeName = MetadataHelper.GetEntityPrimaryKeyAttributeLogicalName(context, quickForm.EntityName); if (string.IsNullOrWhiteSpace(primaryKeyAttributeName)) { ADXTrace.Instance.TraceError(TraceCategory.Application, string.Format("Error retrieving the Primary Key Attribute Name for '{0}'.", EntityNamePrivacy.GetEntityName(quickForm.EntityName))); return; } if (string.IsNullOrWhiteSpace(Metadata.DataFieldName)) { ADXTrace.Instance.TraceError(TraceCategory.Application, string.Format("Quick Form: datafieldname is null for QuickForm with ID='{0}'", quickForm.FormId)); return; } var formEntity = context.CreateQuery(Metadata.TargetEntityName).FirstOrDefault(e => e.GetAttributeValue <Guid>(Metadata.TargetEntityPrimaryKeyName) == entityId); if (formEntity == null) { ADXTrace.Instance.TraceError(TraceCategory.Application, string.Format("Failed to retrieve entity record with ID='{0}'", entityId)); return; } var quickFormEntityReference = formEntity.GetAttributeValue <EntityReference>(Metadata.DataFieldName); if (quickFormEntityReference == null) { ADXTrace.Instance.TraceInfo(TraceCategory.Application, string.Format("Attribute on entity record with ID='{0}' is null. Quick Form not loaded.", entityId)); return; } var src = templatePath; src = src.AppendQueryString("entityid", quickFormEntityReference.Id.ToString()); src = src.AppendQueryString("entityname", quickForm.EntityName); src = src.AppendQueryString("entityprimarykeyname", primaryKeyAttributeName); src = src.AppendQueryString("formname", formName); src = src.AppendQueryString("controlid", Metadata.ControlID); iframe.Src = src; }
protected void Page_Load(object sender, EventArgs e) { // we only want to make this call once, when the page is first loaded. if (!IsPostBack) { try { //get the current user from context string currentUser = User.Identity.Name; //Create the query //This query returns all the video names and links for the given user // this is based off the preferences they have set const string SelectVideosQuery = "SELECT v.name, v.link from videos v INNER JOIN users u LEFT JOIN userInterests ui ON u.id = ui.userId ON v.topicId = ui.videoTopicId WHERE u.email = @loggedInUser"; // Create SQL Command with above query and myConnection declared at class level SqlCommand SelectVideos = new SqlCommand(SelectVideosQuery, myConnection); SelectVideos.Parameters.AddWithValue("@loggedInUser", currentUser); myConnection.Open(); // Execute query and create buffer of query result SqlDataReader reader = SelectVideos.ExecuteReader(); // iterate over all of the result set while (reader.Read()) { //Read the data into varialbes string name = reader[0].ToString(); string link = reader[1].ToString(); //todo: set the video container to a message about no videos found if they don't have any preferences set // Create a wrapper for our iframe HtmlGenericControl iframeWrapper = new HtmlGenericControl("div"); // Add bootstrap responsive classes to it iframeWrapper.Attributes["class"] = "embed-responsive embed-responsive-16by9 col-10 col-sm-3 iframe-wrapper"; // Create our iframe element HtmlIframe iframe = new HtmlIframe(); // Set src property to our link iframe.Src = link; // Add bootstrap classes iframe.Attributes["class"] = "embed-responsive-item"; //allow full screen iframe.Attributes.Add("allowFullScreen", "true"); //Add our iframe to our wrapper iframeWrapper.Controls.Add(iframe); //Add our iframe wrapper to our video container VideoContainer.Controls.Add(iframeWrapper); } // there will be no controls in the video container if the user has no preferences set, so we can display a message telling them to set some. if (VideoContainer.Controls.Count == 0) { var div = new HtmlElement(); div.InnerHtml = "Please choose some topics that interest you in the <a href='preferences.aspx'>preferences</a> page in order to see content here"; VideoContainer.Controls.Add(div); } } catch (SqlException sex) { //Log out the error System.Diagnostics.Debug.WriteLine("SQL Error number: " + sex.Number); System.Diagnostics.Debug.WriteLine("SQL Error message: " + sex.Message); } catch (Exception ex) { //Log out general exception error System.Diagnostics.Debug.WriteLine("General Exception: " + ex.Message); } finally { //close sql connection if its open myConnection.Close(); } } }