Need Help on "Class doesn't support Automation" Error

Discussion in 'JavaScript' started by jawaharks, Nov 17, 2008.

  1. #1
    Hi all,
    Im loading a windows dll in the web project through the javascript. The class in the dll has some functions and properties. Im successful in calling all the functions and some of the properties which has type string. If i try to call one property and assign a value which is of type SessionUser , im getting a error "Class doesn't support Automation". We can send values to property which is of type string. How can i do this.


    Code Sample:


    ///////Buisness Logic////////////////////////////

    public class TestControl.MyControl
    {

    }

    public class DemoClass.MyClass
    {
    private TestControl.MyControl m_crp;

    public object TestCRP
    {
    set
    {
    this.m_crp = (TestControl.MyControl)value;
    }
    }

    public TestControl.MyControl CRP
    {
    get { return this.m_crp; }
    set { this.m_crp = value; }
    }
    }

    /////////////////////////////////////////////////


    ///////////Javascript///////////////////////////

    var MyControl = "TestControl.dll#TestControl.MyControl"
    var MyClass = "DemoClass.dll#DemoClass.MyClass"


    function AddControlToWebPage()
    {
    if (document.forms(0)["AssembliesURL"] != null)
    {
    var assembliespath = document.forms(0)["AssembliesURL"].value;
    var myObject = document.createElement('object');
    document.body.appendChild(myObject);
    myObject.id = "MyControlID";
    myObject.align = "top";
    myObject.classid = assembliespath + MyControl;

    var myObject1 = document.createElement('object');
    document.body.appendChild(myObject1);
    myObject1.id = "MyClassID";
    myObject1.align = "top";
    myObject1.classid = assembliespath + MyClass;

    }
    }



    function SetControlVariables()
    {
    var ControlObject =(document.getElementById("MyControlID"));
    document.getElementById("MyClassID").CRP = ControlObject; //Error is throwing here: Class doesn't support Automation
    //Or if we try like the below line we get this error.
    document.getElementById("MyClassID").TestCRP = ControlObject; //Error is throwing here: "Unable to cast COM object of type 'mshtml.HTMLObjectElementClass' to class type //'Clearview.Document.RenderPanel.Controls.Win.ClearviewRenderPanel'".
    }

    //////////////////////////////////////////////////////////
     
    jawaharks, Nov 17, 2008 IP