Adding a COM object from code-behind into a web form

Discussion in 'ASP .Net' started by John, Nov 30, 2005.

  1. John

    John Guest

    Hi all,

    How do I add a COM object to a web form?

    I notice there's a primary interop assembly for Office web components and
    what I'm trying to do here is to create a PivotTable object (which is fine)
    but then I want to add it to a web page (e.g.
    Page.Controls.Add(COMPivotTable)).

    I receive the following error message but don't understand what I need to do
    to correct this:
    "Unable to cast COM object of type
    'Microsoft.Office.Interop.Owc11.PivotTableClass' to class type
    'System.Web.UI.Control'. Instances of types that represent COM components
    cannot be cast to types that do not represent COM components; however they
    can be cast to interfaces as long as the underlying COM component supports
    QueryInterface calls for the IID of the interface."

    Any ideas?

    Regards
    John.
     
    John, Nov 30, 2005
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Ben Miller [msft]

    Re: Code Behind vs. no code behind: error

    Ben Miller [msft], Jun 27, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    588
    Alphonse Giambrone
    Jun 28, 2003
  2. Daniel Manes

    Code-Behind Pain in the Behind!

    Daniel Manes, Jun 10, 2005, in forum: ASP .Net
    Replies:
    11
    Views:
    665
  3. John
    Replies:
    1
    Views:
    2,479
    Ken Cox
    Dec 1, 2005
  4. John

    Non-code behind to code behind

    John, Feb 19, 2007, in forum: ASP .Net
    Replies:
    2
    Views:
    488
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Feb 19, 2007
  5. Kumarforg

    Web Service invocation from behind proxy behind firewall

    Kumarforg, Aug 3, 2004, in forum: ASP .Net Web Services
    Replies:
    0
    Views:
    190
    Kumarforg
    Aug 3, 2004
Loading...

Share This Page