Click here to Skip to main content
12,240,874 members (63,567 online)
Click here to Skip to main content
Articles » Web Development » ASP.NET » Howto » Downloads


22 bookmarked

A .NET 2.0 Server Control for ActiveX Activation Fix

, 23 Aug 2006 CPOL
A .NET 2.0 server control to fix the ActiveX activation issue caused by Internet Explorer updates.
using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI;

namespace JavascriptWriters
    public class JsWriter : System.Web.UI.HtmlControls.HtmlGenericControl
        public JsWriter(string tagName)
            //Nothing needs to happen here.
        #region Methods & Event Handlers
        protected override void OnPreRender(EventArgs e)
            Page.ClientScript.RegisterClientScriptInclude("jsWritersScript", Page.ClientScript.GetWebResourceUrl(this.GetType(), "JavascriptWriters.javascriptWriters.js"));

        protected override void Render(HtmlTextWriter output)
            string[] htmlLines = (this.InnerHtml.Trim()).Split('\n');
            string outString = "";
            for (int i = 0; i < htmlLines.Length; i++)
                string currentLine = htmlLines[i].Replace("'", "\\'").Replace("\r", "");
                if (i > 0)
                    outString += "+";
                if (i == htmlLines.Length - 1)
                    outString += "'" + currentLine + "';\n";
                    outString += "'" + currentLine + "'\n";
            string varName = "objStr_" + this.UniqueID;
            output.Write("<script language=\"javascript\">");
            output.Write("var " + varName + " = " + outString);
            output.Write("InsertObjectToDocument(document," + varName + ");");

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Chief Technology Officer
United States United States
Seth Berger is a Technology Director at WHITTMANHART Interactive. At WHITTMANHART he develops and manages large .NET projects for some of the world's most successful companies. He is skilled in a large number of languages and development environments but his primary focus is on ASP.NET development, and has worked on it since it was in beta. He previously co-founded Estco Medical, a web development and software company focused on the life-science industry.

You may also be interested in...

| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160426.1 | Last Updated 23 Aug 2006
Article Copyright 2006 by Seth-B
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid