Calling DHTML function from code behind event handler

Discussion in 'ASP .Net' started by Lachlan Gemmell, Jan 22, 2004.

  1. Hello there,

    I'm hoping this is possible but as yet I haven't been able to find out how
    to do it.

    I have placed a client side VBScript function in the HTML of my ASP.NET
    page. Only under certain circumstances I want a server side button click
    event handler in my code behind class to trigger a call of that VBScript
    function. I understand that the call will not be made at the time the server
    side button click event handler but instead will execute later when the page
    is rendered on the client.

    How do I accomplish this?

    Regards,

    Lachlan
     
    Lachlan Gemmell, Jan 22, 2004
    #1
    1. Advertising

  2. Lachlan Gemmell

    Cor Guest

    Lachlan,

    Try this

    \\\needs a button on a webpage
    Private Sub Page_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) Handles MyBase.Load
    If Not IsPostBack Then
    Me.Button1.Text = "Send Mail"
    Me.Button1.Attributes("onClick") = _
    "window.location='mailto:?subject=Cor demo&body=I hope this
    helps?';"
    End If
    End Sub
    ///
    I hope this helps a little bit?

    Cor
    > I have placed a client side VBScript function in the HTML of my ASP.NET
    > page. Only under certain circumstances I want a server side button click
    > event handler in my code behind class to trigger a call of that VBScript
    > function. I understand that the call will not be made at the time the

    server
    > side button click event handler but instead will execute later when the

    page
    > is rendered on the client.
    >
    > How do I accomplish this?
    >
     
    Cor, Jan 22, 2004
    #2
    1. Advertising

  3. Thanks but it wasn't really what I was looking for. I found my solution in
    the Page.RegisterClientScriptBlock() method.

    Regards,

    Lachlan
     
    Lachlan Gemmell, Jan 23, 2004
    #3
  4. Lachlan Gemmell

    Cor Guest

    You mean this one?
    \\\
    Dim str As String
    str = "<script language=javascript> {window.open('http://www.google.com');}
    </script>"
    RegisterStartupScript("Startup", str)
    ///
    I thought your question had to do with the click event?

    Cor
    > Thanks but it wasn't really what I was looking for. I found my solution in
    > the Page.RegisterClientScriptBlock() method.
     
    Cor, Jan 23, 2004
    #4
    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. Fred Armitage
    Replies:
    2
    Views:
    3,418
    Sherif ElMetainy
    Aug 26, 2003
  2. Laurent Bugnion
    Replies:
    1
    Views:
    10,093
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
    Jan 21, 2006
  3. Replies:
    1
    Views:
    733
    Damien
    Feb 22, 2007
  4. Steve
    Replies:
    1
    Views:
    298
    Richard Cornford
    Apr 9, 2005
  5. Replies:
    1
    Views:
    165
    web.dev
    Sep 25, 2006
Loading...

Share This Page