private void RenderHead()
        {
            var head = new HtmlGenericControl("head");

            head.Controls.Add(new HtmlMeta
            {
                HttpEquiv = "content-Type",
                Content   = "text/html; charset=utf8"
            });
            head.Controls.Add(new HtmlMeta
            {
                HttpEquiv = "Date",
                Content   = DateTime.Now.ToString()
            });
            var title = new HtmlTitle();

            title.Controls.AddLiteral("[{0}].[{1}] Comparison Details - DBCompare", SchemaName, TableName);
            head.Controls.Add(title);
            head.Controls.Add(CreateStylesheetElement("jquery-ui-1.10.3.custom.min.css"));
            head.Controls.Add(CreateStylesheetElement("DBCompare.css"));
            head.Controls.Add(CreateScriptElement("jquery-1.10.1.min.js"));
            head.Controls.Add(CreateScriptElement("jquery-ui-1.10.3.custom.min.js"));
            head.Controls.Add(CreateScriptElement("DBCompare.js"));
            head.RenderControl(HWriter);
        }
Exemple #2
0
        private void RenderHead()
        {
            var head = new HtmlGenericControl("head");

            head.Controls.Add(new HtmlMeta
            {
                HttpEquiv = "content-Type",
                Content   = "text/html; charset=utf8"
            });
            head.Controls.Add(new HtmlMeta
            {
                HttpEquiv = "Date",
                Content   = DateTime.Now.ToString()
            });
            var title = new HtmlTitle();

            if (SchemaName == null)
            {
                title.Controls.AddLiteral("Scripts - DBCompare");
            }
            else
            {
                title.Controls.AddLiteral("[{0}].[{1}] Scirpt - DBCompare", SchemaName, TableName);
            }
            head.Controls.Add(title);
            var link = new HtmlLink();

            link.Attributes["rel"]  = "Stylesheet";
            link.Attributes["type"] = "text/css";
            link.Href = WebService.GetFileUrl("DBCompare.css");
            head.Controls.Add(link);
            head.RenderControl(HWriter);
        }
Exemple #3
0
        /// <summary>
        /// 添加标题标签
        /// </summary>
        /// <param name="titleName">页面title</param>
        protected virtual void AddMetaTitle(string titleName)
        {
            HtmlTitle title = new HtmlTitle();

            title.Text = titleName + " - " + AppConfig.PageTitle;
            Page.Header.Controls.Add(title);
        }
        protected override void OnPreInit(EventArgs e)
        {
            this.InitializeTemplate();
            this.m_IsAddHeader = false;
            foreach (Control control in this.Controls)
            {
                HtmlHead head = control as HtmlHead;
                if (head != null)
                {
                    this.m_Header = head;
                    break;
                }
            }
            if (this.m_Header == null)
            {
                this.m_Header = new HtmlHead();
            }
            Match  match = s_RegexHead.Match(this.m_TemplateContent);
            string input = "";

            if (match.Success)
            {
                input = match.Groups[1].Value;
                this.m_TemplateContent = s_RegexHtmlHead.Replace(this.m_TemplateContent, "$1{PE.Control.Header/}");
                Match match2 = s_RegexTitle.Match(input);
                if (match2.Success)
                {
                    input = input.Replace(match2.Value, "");
                    HtmlTemplateTitle child = new HtmlTemplateTitle();
                    if (!string.IsNullOrEmpty(match2.Groups[1].Value))
                    {
                        child.Template = match2.Groups[1].Value;
                    }
                    child.Text = this.m_Header.Title;
                    this.m_Header.InnerHtml = input;
                    this.m_Header.Controls.Add(child);
                }
                else
                {
                    HtmlTitle title2 = new HtmlTitle();
                    title2.Text             = this.m_Header.Title;
                    this.m_Header.InnerHtml = input;
                    this.m_Header.Controls.Add(title2);
                }
            }
            else
            {
                this.m_TemplateContent = s_RegexHtml.Replace(this.m_TemplateContent, "$1{PE.Control.Header/}");
            }
            if (!this.m_TemplateContent.Contains("{PE.Control.Header/}"))
            {
                this.m_TemplateContent = "{PE.Control.Header/}" + this.m_TemplateContent;
            }
            this.RebuildControls(this, this.m_TemplateContent);
            if (!this.m_IsAddHeader)
            {
                this.Controls.AddAt(0, this.m_Header);
            }
            base.OnPreInit(e);
        }
Exemple #5
0
        protected override void Render(HtmlTextWriter writer)
        {
            HtmlTitle htmlTitle = (HtmlTitle)this.Control;

            writer.Write("<title>");
            writer.Write(BasePage.BaseTitle);
            writer.Write("</title>");
        }
Exemple #6
0
    protected void SetMetaTags()
    {
        keyword = (HtmlMeta)Master.FindControl("Keywords");
        title   = (HtmlTitle)Master.FindControl("Title");

        keyword.Content = "Offshore outsourcing, Freelancers, India, Russia, Ukraine, php Programmers, Coders, Developers, Writers, Web Designers, Website Design, Technical Writers";
        title.Text      = "Register an Account - Work4Sale";
    }
        protected override void Render(HtmlTextWriter writer)
        {
            HtmlTitle htmlTitle = (HtmlTitle)this.Control;

            //writer.Indent = 1;//控制标签开始处缩进
            writer.Write("<title>");
            writer.Write(htmlTitle.Text);
            writer.WriteLine("</title>");
        }
    protected void SetMetaTags(ProviderDTO providerseo)
    {
        description = (HtmlMeta)Master.FindControl("Description");
        keyword     = (HtmlMeta)Master.FindControl("Keywords");
        title       = (HtmlTitle)Master.FindControl("Title");

        description.Content = provider.OverView.ToString();
        keyword.Content     = providerseo.FirstName.ToString() + " " + providerseo.MiddleName.ToString() + " " + providerseo.LastName.ToString() + ", " + providerseo.ProviderSkills + ", " + providerseo.Haves;
        title.Text          = providerseo.FirstName.ToString() + " " + providerseo.MiddleName.ToString() + " " + providerseo.LastName.ToString() + " - " + providerseo.Haves.ToString() + " - Work4Sale";
    }
Exemple #9
0
    protected void SetMetaTags()
    {
        description = (HtmlMeta)Master.FindControl("Description");
        keyword     = (HtmlMeta)Master.FindControl("Keywords");
        title       = (HtmlTitle)Master.FindControl("Title");

        description.Content = "Work4Sale is the marketplace for online workteams, with the best business model for both buyers and providers. Our unique approach guarantees to buyers that an hour billed is an";
        keyword.Content     = "About Us, Outsourcing Solution, Job Board, High Technology, Programmers, Developers, Web Design, SEO, Work4Sale";
        title.Text          = "About Us - The Marketplace for Online Workteams - Work4Sale";
    }
    protected void SetMetaTags()
    {
        description = (HtmlMeta)Master.FindControl("Description");
        keyword     = (HtmlMeta)Master.FindControl("Keywords");
        title       = (HtmlTitle)Master.FindControl("Title");

        description.Content = "Browse Profiles & Reviews of Engineers, Freelancers & Programmers - Work4Sale";
        keyword.Content     = " Offshore outsourcing, Freelancers, India, Russia, Ukraine, php Programmers, Coders, Developers, Writers, Web Designers, Website Design, Technical Writers";
        title.Text          = "Browse Profiles & Reviews of Engineers, Freelancers & Programmers - Work4Sale";
    }
Exemple #11
0
        /// <summary>
        /// 初始化对话框窗口标题
        /// </summary>
        /// <param name="header"></param>
        protected virtual void InitDialogTitle(HtmlHead header)
        {
            if (this.Page.IsCallback == false)
            {
                HtmlTitle title = new HtmlTitle();

                title.Text = Translate(this.DialogTitle);
                header.Controls.Add(title);
            }
        }
    protected void SetMetaTags(ProjectDTO projects)
    {
        description = (HtmlMeta)Master.FindControl("Description");
        keyword     = (HtmlMeta)Master.FindControl("Keywords");
        title       = (HtmlTitle)Master.FindControl("Title");

        title.Text          = " Outsource to Freelancers, IT Companies, Programmers, Web Designers from India, Russia, USA, and more ";
        description.Content = "WORK4SALE is a global marketplace that helps employers hire, manage, and pay remote freelancers or teams. It's free to post a job and hire from over 1 million top professionals.";
        keyword.Content     = "Earn money, make money online, Work from Home, Post Projects";
    }
        internal static void MergeToHeadControl(this XhtmlDocument xhtmlDocument, HtmlHead headControl, IXElementToControlMapper controlMapper)
        {
            XElement headSource = xhtmlDocument.Head;

            if (headSource == null)
            {
                return;
            }

            CopyAttributes(headSource, headControl);

            XElement titleElement = headSource.Elements(XName_Title).LastOrDefault();

            if (titleElement != null)
            {
                HtmlTitle existingControl = headControl.Controls.OfType <HtmlTitle>().FirstOrDefault();

                if (existingControl != null)
                {
                    headControl.Controls.Remove(existingControl);
                }

                // NOTE: we aren't using headControl.Title property since it adds "<title>" tag as the last one
                headControl.Controls.AddAt(0, new HtmlTitle {
                    Text = HttpUtility.HtmlEncode(titleElement.Value)
                });
            }

            var metaTags        = headSource.Elements().Where(f => f.Name == XName_Meta);
            int metaTagPosition = Math.Min(1, headControl.Controls.Count);

            foreach (var metaTag in metaTags)
            {
                var metaControl = new HtmlMeta();
                foreach (var attribute in metaTag.Attributes())
                {
                    if (attribute.Name.LocalName == "id")
                    {
                        metaControl.ID = attribute.Value;
                    }
                    else
                    {
                        metaControl.Attributes.Add(attribute.Name.LocalName, attribute.Value);
                    }
                }
                headControl.Controls.AddAt(metaTagPosition++, metaControl);
            }

            ExportChildNodes(headSource.Nodes().Where(f =>
                                                      !(f is XElement element) || (element.Name != XName_Title && element.Name != XName_Meta)),
                             headControl, controlMapper);

            headControl.RemoveDuplicates();
        }
Exemple #14
0
        private void AddTagTitle(Control tagTitle)
        {
            HtmlTitle htmlTagTitle = new HtmlTitle();

            htmlTagTitle.Text = "Column Permission";

            //Iny sposob zmeny

            Page.Header.Controls.Remove(Page.Header.FindControl("PlaceHolderPageTitle").Parent);
            Page.Header.Controls.Add(htmlTagTitle);
        }
Exemple #15
0
        protected virtual void AddMetaTitle(string content)
        {
            if (content == "")
            {
                return;
            }
            HtmlTitle title = new HtmlTitle();

            title.Text = content;
            // Page.Header.Controls.Add(title);
        }
Exemple #16
0
        private HtmlTitle __BuildControl__control5()
        {
            HtmlTitle       title    = new HtmlTitle();
            LiteralControl  control  = this.__BuildControl__control6();
            IParserAccessor accessor = title;

            accessor.AddParsedSubObject(control);
            object[] parameters = new object[5];
            parameters[0] = title;
            parameters[2] = 0x107;
            parameters[3] = 0x13;
            parameters[4] = false;
            this.__PageInspector_SetTraceData(parameters);
            return(title);
        }
Exemple #17
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            System.Web.UI.HtmlControls.HtmlTitle pagTitle = new HtmlTitle();
            pagTitle.Text = ResourceManager.GetString("pagTitle");


            if (!Page.IsPostBack)
            {
                LoadPolicy();
            }
            else
            {
                this.HandlePageEvents(Request.Form["__EVENTTARGET"], Request.Form["__EVENTARGUMENT"]);
            }
        }
Exemple #18
0
        private HtmlHead __BuildControl__control3()
        {
            HtmlHead        head     = new HtmlHead("head");
            HtmlMeta        meta     = this.__BuildControl__control4();
            IParserAccessor accessor = head;

            accessor.AddParsedSubObject(meta);
            HtmlTitle title = this.__BuildControl__control5();

            accessor.AddParsedSubObject(title);
            object[] parameters = new object[5];
            parameters[0] = head;
            parameters[2] = 0xa1;
            parameters[3] = 130;
            parameters[4] = false;
            this.__PageInspector_SetTraceData(parameters);
            return(head);
        }
Exemple #19
0
    protected void SetMetaTags(ProjectDTO projects)
    {
        description = (HtmlMeta)Master.FindControl("Description");
        keyword     = (HtmlMeta)Master.FindControl("Keywords");
        title       = (HtmlTitle)Master.FindControl("Title");

        title.Text      = projects.ProjectTitle + "-" + projects.ProjectCategory + "- work4Sale";
        keyword.Content = projects.ProjectSkills.ToString() + "," + projects.ProjectCategory;

        if (project.Description.Length > 700)
        {
            description.Content = projects.Description.Substring(0, 700).Trim().Replace("<br />", " ").ToString();
        }
        else
        {
            description.Content = projects.Description;
        }
    }
Exemple #20
0
        /// <summary>
        /// 系统名称、标题栏、页面地图、用户名
        /// </summary>
        private void InitPageData()
        {
            HtmlTitle hTitle = new HtmlTitle();

            if (hidTitle.Attributes["sign"] == "true")
            {
                hTitle.Text = hidTitle.Value;
            }
            else
            {
                hTitle.Text = Request.GetTitle();
            }
            if (labWebSite.Attributes["Sign"] == "false")
            {
                labWebSite.Text = Request.GetSiteMap();
            }
            Head1.Controls.Add(hTitle);
        }
        /// <summary>
        /// 系统名称、标题栏、页面地图、用户名
        /// </summary>
        private void InitPageData()
        {
            sysName.InnerText = BusAppInfo.Name;
            HtmlTitle hTitle = new HtmlTitle();

            if (hidTitle.Attributes["sign"] == "true")
            {
                hTitle.Text = hidTitle.Value;
            }
            else
            {
                hTitle.Text = Request.GetTitle();
            }
            if (labWebSite.Attributes["Sign"] == "false")
            {
                labWebSite.Text = Request.GetSiteMap();
            }
            Head1.Controls.Add(hTitle);
            labUserName.Text = me.Name;
        }
Exemple #22
0
        public static void SetPageHeader(Page p, string strtitle, string description, string keywords, int pageIndex)
        {
            string    FormatString = "{0} - {1}";
            HtmlTitle title        = (HtmlTitle)p.Master.FindControl("title");
            HtmlMeta  metaDesc     = (HtmlMeta)p.Master.FindControl("description");
            HtmlMeta  keyword      = (HtmlMeta)p.Master.FindControl("keywords");

            if (strtitle != "" && title != null)
            {
                title.Text = CatCharactor(String.Format(FormatString, strtitle, pageIndex < 2 ? "" : pageIndex.ToString()), 70);
            }
            if (description != "" && (metaDesc != null))
            {
                metaDesc.Content = CatCharactor(String.Format(FormatString, description, pageIndex), 160);
            }
            if (keywords != "" && (keyword != null))
            {
                keyword.Content = CatCharactor(String.Format(FormatString, keywords, pageIndex), 160);
            }
        }
        protected override void OnPreRender(EventArgs e)
        {
            bool hasTitle = false;

            foreach (Control cntrl in this.Control.Controls)
            {
                if (cntrl is HtmlTitle)
                {
                    hasTitle = true;
                    break;
                }
            }
            if (!hasTitle)
            {
                HtmlTitle ht = new HtmlTitle();
                ht.Text = Page.Title;
                Control.Controls.Add(ht);
            }
            base.OnPreRender(e);
        }
Exemple #24
0
        private void SetHeadMetaTagsAndTitle()
        {
            var contextNode = PortalContext.Current.ContextNode ?? SenseNet.Portal.Page.Current;

            string keywords   = GetSeoFieldValue(contextNode, "Keywords");
            string metaDesc   = GetSeoFieldValue(contextNode, "MetaDescription");
            string author     = GetSeoFieldValue(contextNode, "MetaAuthors");
            string customMeta = GetSeoFieldValue(contextNode, "CustomMeta");
            string metaTitle  = GetSeoFieldValue(contextNode, "MetaTitle");

            if (!String.IsNullOrEmpty(metaTitle))
            {
                HtmlTitle t = GetTitle();
                if (t != null)
                {
                    t.Text = metaTitle;
                }
            }

            if (!string.IsNullOrEmpty(keywords))
            {
                AddMetaTag(keywords, "Keywords");
            }

            if (!string.IsNullOrEmpty(metaDesc))
            {
                AddMetaTag(metaDesc, "Description");
            }

            if (!string.IsNullOrEmpty(author))
            {
                AddMetaTag(author, "Author");
            }

            if (!string.IsNullOrEmpty(customMeta))
            {
                this.Header.Controls.Add(new LiteralControl(customMeta));
            }
        }
Exemple #25
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            System.Web.UI.HtmlControls.HtmlTitle pagTitle = new HtmlTitle();
            pagTitle.Text = ResourceManager.GetString("pagTitle");

            if (!Page.IsPostBack)
            {
                LoadPolicy();
            }
            else
            {
                this.HandlePageEvents(Request.Form["__EVENTTARGET"], Request.Form["__EVENTARGUMENT"]);
            }
            System.Web.UI.WebControls.Label lblEventTerm = new Label();
            if (Request.RawUrl.Contains("term=y"))
            {
                pnlterm.Visible = true;
            }
            else
            {
                pnlterm.Visible = false;
            }
        }
Exemple #26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        description = (HtmlMeta)Master.FindControl("Description");
        keyword     = (HtmlMeta)Master.FindControl("Keywords");
        title       = (HtmlTitle)Master.FindControl("Title");

        title.Text          = "Search Jobs & Work at Home on Largest Online Freelance Job Network - Work4Sale";
        description.Content = "Employers looking for freelancers to work from home on outsourced projects through our global jobs' employment platform. Post your resume or cv and get hired today.";
        keyword.Content     = "search job, work from home, online jobs, outsourcing jobs, freelance online, freelancers ";



        if (!IsPostBack)
        {
            if (Request.QueryString.ToString() != "")
            {
                if (Request.QueryString["searchtext"].ToString() != "")
                {
                    SearchText = Request.QueryString["searchtext"].ToString();
                }

                if (Request.QueryString["Categories"].ToString() != "")
                {
                    Categorys = Request.QueryString["Categories"].ToString();
                }

                if (Request.QueryString["JobType"].ToString() != "")
                {
                    Jobtype = Request.QueryString["JobType"].ToString();
                }

                if (Request.QueryString["Postedsince"].ToString() != "")
                {
                    Postedsince = Request.QueryString["Postedsince"].ToString();
                }

                if (Request.QueryString["TimeLeft"].ToString() != "")
                {
                    TimeLeft = Request.QueryString["TimeLeft"].ToString();
                }

                projectbl = new ProjectBL();
                projects  = new List <ProjectDTO>();

                projects = projectbl.SearchProjectBYQuery(SearchText, categorys, Jobtype, Postedsince, TimeLeft, "");

                if (projects == null)
                {
                    LblNorecord.Visible = true;
                }
                else
                {
                    DataListProject.DataSource = projects;
                    DataListProject.DataBind();
                }
            }
            else
            {
                BindItemsList();
            }
        }
    }
Exemple #27
0
        private void HandleOpenTag(Stack <Control> container, HtmlChunk chunk, StringBuilder currentLiteralText)
        {
            if (chunk.TagName.Equals("title", StringComparison.OrdinalIgnoreCase) && isCurrentlyInHeadTag)
            {
                // if we are not currently parsing the <head> tag, then this title must be in the body and we should skip it
                this.AddIfNotEmpty(currentLiteralText.ToString(), container.Peek());
                var title = new HtmlTitle();
                container.Peek().Controls.Add(title);
                container.Push(title);
            }
            else if (chunk.TagName.Equals("head", StringComparison.OrdinalIgnoreCase))
            {
                this.AddIfNotEmpty(currentLiteralText.ToString(), container.Peek());
                currentLiteralText.Clear();
                var head = new HtmlHead();
                container.Peek().Controls.Add(head);
                container.Push(head);
                isCurrentlyInHeadTag = true;
            }
            else if (chunk.TagName.Equals("asp:ContentPlaceHolder", StringComparison.OrdinalIgnoreCase))
            {
                this.AddIfNotEmpty(currentLiteralText.ToString(), container.Peek());
                currentLiteralText.Clear();

                if (chunk.HasAttribute("ID"))
                {
                    var id          = chunk.AttributesMap["ID"] as string;
                    var placeHolder = new ContentPlaceHolder()
                    {
                        ID = id
                    };
                    container.Peek().Controls.Add(placeHolder);
                    this.AddContentPlaceHolder(id);
                    this.InstantiateControls(placeHolder);
                }
            }
            else if (chunk.TagName.Equals("form", StringComparison.OrdinalIgnoreCase) && chunk.HasAttribute("runat"))
            {
                this.AddIfNotEmpty(currentLiteralText.ToString(), container.Peek());
                currentLiteralText.Clear();

                var form = new HtmlForm();
                if (chunk.HasAttribute("id"))
                {
                    form.ID = chunk.AttributesMap["id"] as string;
                }
                else
                {
                    form.ID = "aspnetForm";
                }

                container.Peek().Controls.Add(form);
                container.Push(form);
            }
            else if (chunk.TagName.Equals(LayoutsHelpers.SectionTag, StringComparison.OrdinalIgnoreCase))
            {
                this.AddIfNotEmpty(currentLiteralText.ToString(), container.Peek());
                currentLiteralText.Clear();

                var sectionRenderer = new SectionRenderer();
                if (chunk.HasAttribute("name"))
                {
                    sectionRenderer.Name = chunk.AttributesMap["name"].ToString();
                }

                container.Peek().Controls.Add(sectionRenderer);
            }
            else if (chunk.TagName.Equals("meta", StringComparison.OrdinalIgnoreCase))
            {
                this.AddIfNotEmpty(currentLiteralText.ToString(), container.Peek());
                currentLiteralText.Clear();

                this.AddIfNotEmpty(chunk.Html, container.Peek());
            }
            else if (chunk.TagName == "%@")
            {
                //// Ignore
            }
            else
            {
                currentLiteralText.Append(chunk.Html);
            }
        }
Exemple #28
0
    protected void LoadDoc()
    {
        theFrameHolder.Controls.Clear();


        Literal frame1 = new Literal();

        //// NEED TO TRAP WHEN AN INCORRECT DocVersID IS RECEIVED
        //HtmlControl frame1 = new System.Web.UI.HtmlControls.HtmlGenericControl("iframe");



        HtmlTitle title    = (HtmlTitle)this.Master.FindControl("oTitle");
        String    dv_title = "";

        if (FormView1.CurrentMode == FormViewMode.ReadOnly)
        {
            try
            {
                dv_title = ((Label)this.FormView1.FindControl("DocTitleLabel")).Text;
            }
            catch (Exception ex)
            {
                string x = ex.Message;
                try
                { dv_title = ViewState["doctitle"].ToString(); }
                catch (Exception ex2)
                { dv_title = "";
                  string x2 = ex2.Message; }
            }

            title.Text = "(#" + Request.Params["DocVersID"] + ") " + dv_title;

            //ReadOnly or Itemtemplate mode
            DisplayDoc_Button.Visible = false;


            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "spGet_FileExt_for_DocVersID";
            cmd.Connection  = oConn;
            if (oConn.State == ConnectionState.Closed)
            {
                oConn.Open();
            }

            cmd.Parameters.Add("@docversID", SqlDbType.Int);
            cmd.Parameters["@docversID"].Direction = ParameterDirection.Input;
            cmd.Parameters["@docversID"].Value     = Convert.ToInt32(Request.Params["DocVersID"]);

            cmd.Parameters.Add("@ext", SqlDbType.VarChar, 20);
            cmd.Parameters["@ext"].Direction = ParameterDirection.Output;
            cmd.Parameters["@ext"].Value     = "";

            cmd.ExecuteNonQuery();


            string fileext_output = cmd.Parameters["@ext"].Value.ToString();

            //jmInfo.Text = cmd.Parameters["@ext"].Value.ToString();

            if (fileext_output.ToLower() == ".jpg" ||
                fileext_output.ToLower() == ".jpeg" ||
                fileext_output.ToLower() == ".png" ||
                fileext_output.ToLower() == ".bmp" ||
                fileext_output.ToLower() == ".gif" ||
                fileext_output.ToLower() == ".txt" ||
                fileext_output.ToLower() == ".pdf" ||
                fileext_output.ToLower() == ".R")
            {
                try
                {
                    frame1.Text = "<embed src=\"" + ((Label)this.FormView1.FindControl("DocLinkLabel")).Text + "\" width=\"990\" height=\"800\">";
                    //frame1.Attributes["src"] = ((Label)this.FormView1.FindControl("DocLinkLabel")).Text;
                }
                catch (Exception ex)
                {
                    string x = ex.Message;
                    if (ViewState["doclink"] != null)
                    {
                        frame1.Text = "<embed src=\"" + ViewState["doclink"].ToString() + "\" width=\"990\" height=\"800\">";
                        //frame1.Attributes["src"] = ViewState["doclink"].ToString();
                    }
                    else
                    {
                        frame1.Text = "PDF here.";
                        //frame1.Attributes["src"] = "";
                    }
                }


                //frame1.Attributes["style"] = "width:100%; height:800px";
                //frame1.Attributes["frameborder"] = "1";
                //frame1.Attributes["scrolling"] = "auto";
                //frame1.Attributes["align"] = "top";

                theFrameHolder.Controls.Add(frame1);

                Label_Error.Text = "";
            }
            else
            {
                Label_Error.Text = "This is a " + fileext_output + " document that cannot be opened in a browser.  Use the folowing link to save a local copy.<br/>If you 'right-click' the link you can select the 'Save Target As...' option to save the file locally.<br/>If you 'Open' it directly you may be prompted to enter your username and password. ";

                linkDownloadFile.Visible     = true;
                linkDownloadFile.NavigateUrl = ViewState["doclink"].ToString();

                //Label_Error.Text = "Not a supported filetype: " + fileext_output;
            }
        }



        if (FormView1.CurrentMode == FormViewMode.Insert)
        {
            DisplayDoc_Button.Visible = false;
            title.Text = "(#" + Request.Params["DocVersID"] + ") New Version";
        }
        if (FormView1.CurrentMode == FormViewMode.Edit)
        {
            DisplayDoc_Button.Visible = false;
            title.Text = "(#" + Request.Params["DocVersID"] + ") Edit Doc";
        }
    }
Exemple #29
0
    protected void LoadDoc()
    {
        theFrameHolder.Controls.Clear();

        Literal frame1 = new Literal();

        //// NEED TO TRAP WHEN AN INCORRECT DocVersID IS RECEIVED

        HtmlTitle title    = (HtmlTitle)this.Master.FindControl("oTitle");
        String    dv_title = "";

        if (FormView1.CurrentMode == FormViewMode.ReadOnly)
        {
            try
            {
                dv_title = ((Label)this.FormView1.FindControl("DocTitleLabel")).Text;
            }
            catch (Exception ex)
            {
                string x = ex.Message;
                try
                { dv_title = ViewState["doctitle"].ToString(); }
                catch (Exception ex2)
                { dv_title = "";
                  string x2 = ex2.Message; }
            }

            title.Text = "(#" + Request.Params["DocVersID"] + ") " + dv_title;

            //ReadOnly or Itemtemplate mode
            DisplayDoc_Button.Visible = false;


            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "spGet_FileExt_for_DocVersID";
            cmd.Connection  = oConn;
            if (oConn.State == ConnectionState.Closed)
            {
                oConn.Open();
            }

            cmd.Parameters.Add("@docversID", SqlDbType.Int);
            cmd.Parameters["@docversID"].Direction = ParameterDirection.Input;
            cmd.Parameters["@docversID"].Value     = Convert.ToInt32(Request.Params["DocVersID"]);

            cmd.Parameters.Add("@ext", SqlDbType.VarChar, 20);
            cmd.Parameters["@ext"].Direction = ParameterDirection.Output;
            cmd.Parameters["@ext"].Value     = "";

            cmd.ExecuteNonQuery();


            string fileext_output = cmd.Parameters["@ext"].Value.ToString();

            //jmInfo.Text = cmd.Parameters["@ext"].Value.ToString();

            if (fileext_output.ToLower() == ".jpg" ||
                fileext_output.ToLower() == ".jpeg" ||
                fileext_output.ToLower() == ".png" ||
                fileext_output.ToLower() == ".bmp" ||
                fileext_output.ToLower() == ".gif" ||
                fileext_output.ToLower() == ".txt" ||
                fileext_output.ToLower() == ".pdf" ||
                fileext_output.ToLower() == ".R"
                )
            {
                try
                {
                    string txt = "https://shs1.autism.washington.edu" + Request.ApplicationPath.ToString() + ((Label)this.FormView1.FindControl("DocLinkLabel")).Text;

                    string fullfilename = HttpContext.Current.Server.MapPath(ViewState["doclink"].ToString());
                    //string fullfilename = HttpContext.Current.Server.MapPath("~/webdocs/" + ViewState["doclink"].ToString());

                    lblFilePath.Text = fullfilename;
                    frame1.Text      = "<embed src=\"" + fullfilename + "\" width=\"990\" height=\"800\">";                // "<embed src=\"" + ((Label)this.FormView1.FindControl("DocLinkLabel")).Text + "\" width=\"990\" height=\"800\">";
                    //frame1.Attributes["src"] = ((Label)this.FormView1.FindControl("DocLinkLabel")).Text;
                }
                catch (Exception ex)
                {
                    string x = ex.Message;
                    if (ViewState["doclink"] != null)
                    {
                        frame1.Text = "<embed src=\"" + ViewState["doclink"].ToString() + "\" width=\"990\" height=\"800\">";
                        //frame1.Attributes["src"] = ViewState["doclink"].ToString();
                    }
                    else
                    {
                        frame1.Text = "PDF here.";
                        //frame1.Attributes["src"] = "";
                    }
                }


                //frame1.Attributes["style"] = "width:100%; height:800px";
                //frame1.Attributes["frameborder"] = "1";
                //frame1.Attributes["scrolling"] = "auto";
                //frame1.Attributes["align"] = "top";

                theFrameHolder.Controls.Add(frame1);

                Label_Error.Text = "";
            }


            else
            {
                Label_Error.Text = "This is a " + fileext_output + " document that cannot be opened in a browser.<br/>Your browser may prompt you to save the file locally before opening it.";

                //linkDownloadFile.Visible = true;
                //linkDownloadFile.NavigateUrl = ViewState["doclink"].ToString();

                //Label_Error.Text = "Not a supported filetype: " + fileext_output;
            }


            Button btnDownloadFile = (Button)FormView1.FindControlRecursive("btnDownloadFile");

            btnDownloadFile.Visible         = true;
            btnDownloadFile.Text            = "Download " + ViewState["doclink"].ToString().Replace("/webdocs/", "");
            btnDownloadFile.CommandArgument = ViewState["doclink"].ToString();
        }



        if (FormView1.CurrentMode == FormViewMode.Insert)
        {
            DisplayDoc_Button.Visible = false;
            title.Text = "(#" + Request.Params["DocVersID"] + ") New Version";
        }
        if (FormView1.CurrentMode == FormViewMode.Edit)
        {
            DisplayDoc_Button.Visible = false;
            title.Text = "(#" + Request.Params["DocVersID"] + ") Edit Doc";
        }
    }
Exemple #30
0
 protected void SetMetaTags()
 {
     title      = (HtmlTitle)Master.FindControl("Title");
     title.Text = "Log In - Work4Sale";
 }