Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Passing params to an embedded control in IE

Passing params to an embedded control in IE

Scheduled Pinned Locked Moved C#
csharphostinghardwaretoolsquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    TigerNinja_
    wrote on last edited by
    #1

    I am hosting a .NET control inside of IE. Syntax: However, I want my .aspx page to be able to pass params to the PrintConfig.dll, is this possible ? If so, could you point me to a reference or documentation ? Thanks.


    R.Bischoff  .NET, Kommst du mit?

    H 1 Reply Last reply
    0
    • T TigerNinja_

      I am hosting a .NET control inside of IE. Syntax: However, I want my .aspx page to be able to pass params to the PrintConfig.dll, is this possible ? If so, could you point me to a reference or documentation ? Thanks.


      R.Bischoff  .NET, Kommst du mit?

      H Offline
      H Offline
      Heath Stewart
      wrote on last edited by
      #2

      First, your classid attribute should not include "http:". Use a relative path or an absolute path. Only include "http://" plus the host name if you want to use a control from another site (in which case that site needs to be configured in the Url evidence for the code access security group that must be created - all covered in my article I linked the other day. On your class interface, declare a property of type object or IWebBrowser2 (requires that you reference the shdocvw.dll native COM server, which creates an interop assembly (default is typically Interop.SHDocVw.dll) that must be in the same directory (or if you read the documentation about the assembly binding configuration settings - you can figure out other places to put it) as the PrintConfig.dll. Make sure you implement this property in your user control. Then, in your .aspx page for the onload event of your OBJECT (to make sure it's loaded first, otherwise an error will occur), set that property to the window object of the web browser. You must use a dispatch interface or the scripting engine cannot access the object model. My article I linked also covers this, as well as why auto-generated class interfaces should not be used (declare them explicitly and implement them as the first interface in your class declaration).

      Microsoft MVP, Visual C# My Articles

      T 2 Replies Last reply
      0
      • H Heath Stewart

        First, your classid attribute should not include "http:". Use a relative path or an absolute path. Only include "http://" plus the host name if you want to use a control from another site (in which case that site needs to be configured in the Url evidence for the code access security group that must be created - all covered in my article I linked the other day. On your class interface, declare a property of type object or IWebBrowser2 (requires that you reference the shdocvw.dll native COM server, which creates an interop assembly (default is typically Interop.SHDocVw.dll) that must be in the same directory (or if you read the documentation about the assembly binding configuration settings - you can figure out other places to put it) as the PrintConfig.dll. Make sure you implement this property in your user control. Then, in your .aspx page for the onload event of your OBJECT (to make sure it's loaded first, otherwise an error will occur), set that property to the window object of the web browser. You must use a dispatch interface or the scripting engine cannot access the object model. My article I linked also covers this, as well as why auto-generated class interfaces should not be used (declare them explicitly and implement them as the first interface in your class declaration).

        Microsoft MVP, Visual C# My Articles

        T Offline
        T Offline
        TigerNinja_
        wrote on last edited by
        #3

        Sorry about that Heath, I just skimmed your article, I should have read more thoroughly. Filling the gap of the .aspx page (server) and the embedded control (local machine) with the web browser interface makes perfect sense. I'll give it a go! Thanks again for the tips.


        R.Bischoff  .NET, Kommst du mit?

        1 Reply Last reply
        0
        • H Heath Stewart

          First, your classid attribute should not include "http:". Use a relative path or an absolute path. Only include "http://" plus the host name if you want to use a control from another site (in which case that site needs to be configured in the Url evidence for the code access security group that must be created - all covered in my article I linked the other day. On your class interface, declare a property of type object or IWebBrowser2 (requires that you reference the shdocvw.dll native COM server, which creates an interop assembly (default is typically Interop.SHDocVw.dll) that must be in the same directory (or if you read the documentation about the assembly binding configuration settings - you can figure out other places to put it) as the PrintConfig.dll. Make sure you implement this property in your user control. Then, in your .aspx page for the onload event of your OBJECT (to make sure it's loaded first, otherwise an error will occur), set that property to the window object of the web browser. You must use a dispatch interface or the scripting engine cannot access the object model. My article I linked also covers this, as well as why auto-generated class interfaces should not be used (declare them explicitly and implement them as the first interface in your class declaration).

          Microsoft MVP, Visual C# My Articles

          T Offline
          T Offline
          TigerNinja_
          wrote on last edited by
          #4

          Heath Stewart wrote: Then, in your .aspx page for the onload event of your OBJECT (to make sure it's loaded first, otherwise an error will occur), set that property to the window object of the web browser. Does OBJECT has an onload event ? During the step of setting the property, say Prop1 to the window object, what does this syntax look like ? p.s. Is it possible for my .aspx to read values from the embedded c# control ? thanks again.

          R.Bischoff

          Denn Gott hat die Menschen so sehr geliebt, daß er seinen einzigen Sohn für sie hergab. Jeder, der an ihn glaubt, wird nicht verlorengehen, sondern das ewige Leben haben

          H 1 Reply Last reply
          0
          • T TigerNinja_

            Heath Stewart wrote: Then, in your .aspx page for the onload event of your OBJECT (to make sure it's loaded first, otherwise an error will occur), set that property to the window object of the web browser. Does OBJECT has an onload event ? During the step of setting the property, say Prop1 to the window object, what does this syntax look like ? p.s. Is it possible for my .aspx to read values from the embedded c# control ? thanks again.

            R.Bischoff

            Denn Gott hat die Menschen so sehr geliebt, daß er seinen einzigen Sohn für sie hergab. Jeder, der an ihn glaubt, wird nicht verlorengehen, sondern das ewige Leben haben

            H Offline
            H Offline
            Heath Stewart
            wrote on last edited by
            #5

            No, but you could use onreadystatechanged:

            <object id="myControl" clsid="MyAssembly.dll#MyNamespace.MyControl"
            onreadystatechanged="setProperties();">
            </object>
            <script language="javascript">
            function setProperties()
            {
            if (myControl.readyState == "complete")
            myControl.Prop1 = "something";
            }

            Don't forget, though, that you can use the <param> tags inside the <object> element to set public properties on the control as well.

            Microsoft MVP, Visual C# My Articles

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups