using client-side component keeps calling component's init

Discussion in 'ASP .Net' started by Jim Hammond, Nov 12, 2003.

  1. Jim Hammond

    Jim Hammond Guest

    The following code uses a client-side component to capture an image from the
    camera on the client system.

    The problem is that the init function (in ClientSideAssembly_Video.dll) is
    called once when the page is first displayed and then each time the button
    is pressed.

    I'm guessing that the component is being instantiated each time. Is there
    any way to keep using the same instance?

    Thanks,

    Jim


    <body MS_POSITIONING="GridLayout">
    <OBJECT id="Object1"

    classid="ClientSideAssembly_Video.dll#ClientSideAssembly_Video.VideoDisplay"
    name="VideoControl" VIEWASTEXT>
    </OBJECT>
    <form id="Form3" name="Form1" method="post"
    encType="multipart/form-data" runat="server" VIEWASTEXT>
    <INPUT id="Hidden3" type="hidden" name="hidden1" runat="server">
    <asp:image id="Image1" runat="server"></asp:image>
    <asp:button id="Button3" runat="server" Text="TAKE
    PHOTO"></asp:button>
    </form>
    <script language="javascript">
    function TakePicture()
    {
    VideoControl.TakePicture();
    document.Form1.hidden1.value = VideoControl.jpgFile;
    }
    </script>
    </body>


    I enable the button to call the JavaScript function TakePicture() with the
    following
    C# code in the web form:

    private void Page_Load(object sender, System.EventArgs e)
    {
    if (!IsPostBack)
    Button3.Attributes.Add("onclick", "TakePicture()");
    }
    Jim Hammond, Nov 12, 2003
    #1
    1. Advertising

  2. Jim Hammond

    Jim Hammond Guest

    The following code uses a client-side component to capture an image from the
    camera on the client system.

    The problem is that the init function (in ClientSideAssembly_Video.dll) is
    called once when the page is first displayed and then each time the button
    is pressed.

    I'm guessing that the component is being instantiated each time. Is there
    any way to keep using the same instance?

    This happens even if I comment out the statements inside the JavaScript
    function.

    Thanks,

    Jim


    <body MS_POSITIONING="GridLayout">
    <OBJECT id="Object1"

    classid="ClientSideAssembly_Video.dll#ClientSideAssembly_Video.VideoDisplay"
    name="VideoControl" VIEWASTEXT>
    </OBJECT>
    <form id="Form3" name="Form1" method="post"
    encType="multipart/form-data" runat="server" VIEWASTEXT>
    <INPUT id="Hidden3" type="hidden" name="hidden1" runat="server">
    <asp:image id="Image1" runat="server"></asp:image>
    <asp:button id="Button3" runat="server" Text="TAKE
    PHOTO"></asp:button>
    </form>
    <script language="javascript">
    function TakePicture()
    {
    VideoControl.TakePicture();
    document.Form1.hidden1.value = VideoControl.jpgFile;
    }
    </script>
    </body>


    I enable the button to call the JavaScript function TakePicture() with the
    following
    C# code in the web form:

    private void Page_Load(object sender, System.EventArgs e)
    {
    if (!IsPostBack)
    Button3.Attributes.Add("onclick", "TakePicture()");
    }
    Jim Hammond, Nov 12, 2003
    #2
    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. Tony Cheng
    Replies:
    1
    Views:
    8,171
    Juan T. Llibre
    Feb 24, 2006
  2. Replies:
    1
    Views:
    636
    Jules
    Aug 18, 2005
  3. Jess
    Replies:
    4
    Views:
    424
  4. news.aon.at
    Replies:
    11
    Views:
    624
    Ian Collins
    Jan 29, 2011
  5. Miguel Guerreiro

    server-side ASP w/ client -side component

    Miguel Guerreiro, Aug 4, 2003, in forum: ASP General
    Replies:
    0
    Views:
    122
    Miguel Guerreiro
    Aug 4, 2003
Loading...

Share This Page