LoginAuthenticate\JavaScriptFunction

Discussion in 'ASP .Net' started by gh, Jun 11, 2008.

  1. gh

    gh Guest

    In the Login1_Authenticate event I check to see if the login is valid
    and if it is I have a javascript function before the body tag in the
    aspx file I want to call. When I try to call the function I get the
    following error:

    The name 'myFunction' does not exist in the current context login.aspx.cs

    What am I missing?

    TIA

    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    {

    if (dsLogin.Tables[0].Rows.Count == 1)
    {
    Login1.FailureText = "";
    myFunction(dsLogin.Tables[0].Rows[0]["CONAME"].ToString());

    }

    }




    The function in the aspx file

    <script language="javascript" type="text/javascript">
    function myFunction(Value)
    {

    window.parent.set_value(Value);
    }
    </script>
     
    gh, Jun 11, 2008
    #1
    1. Advertising

  2. gh

    bruce barker Guest

    the server can not call client javascript. its just producing html that the
    browser will display. you can render inline javascript that the browser will
    execute. see ClientScriptManger.RegisterStartupScript

    -- bruce (sqlwork.com)


    "gh" wrote:

    > In the Login1_Authenticate event I check to see if the login is valid
    > and if it is I have a javascript function before the body tag in the
    > aspx file I want to call. When I try to call the function I get the
    > following error:
    >
    > The name 'myFunction' does not exist in the current context login.aspx.cs
    >
    > What am I missing?
    >
    > TIA
    >
    > protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    > {
    >
    > if (dsLogin.Tables[0].Rows.Count == 1)
    > {
    > Login1.FailureText = "";
    > myFunction(dsLogin.Tables[0].Rows[0]["CONAME"].ToString());
    >
    > }
    >
    > }
    >
    >
    >
    >
    > The function in the aspx file
    >
    > <script language="javascript" type="text/javascript">
    > function myFunction(Value)
    > {
    >
    > window.parent.set_value(Value);
    > }
    > </script>
    >
     
    bruce barker, Jun 11, 2008
    #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. maximz2005
    Replies:
    1
    Views:
    538
    maximz2005
    Dec 13, 2008
  2. zxo102
    Replies:
    0
    Views:
    414
    zxo102
    Oct 12, 2009
  3. Fjodor Klondyke

    how to place a <br> in a javascriptfunction?

    Fjodor Klondyke, Aug 3, 2003, in forum: Javascript
    Replies:
    1
    Views:
    114
    Lasse Reichstein Nielsen
    Aug 3, 2003
Loading...

Share This Page