Professional Web Applications Themes

Tricky postback - ASP.NET General

I tried to run your code and I am getting errors 'ASP.WebForm1_aspx' does not contain a definition for 'Login_Click' ??? "eruess" <eruessr.com> wrote in message news:PI6dncXcTYbddq-iRVn-hgspeakeasy.net... > I had this problem with an authentication page where authenticating the user > took a few seconds and I didn't want them to keep clicking. Basically you > have to do 2 things with 1 click... something to visually alter the screen, > and then handle the actual click in your c/vb.net code. > > Make a javascript block to do whatever you need to do on the client when > they click ...

  1. #1

    Default Re: Tricky postback

    I tried to run your code and I am getting errors
    'ASP.WebForm1_aspx' does not contain a definition for 'Login_Click'

    ???

    "eruess" <eruessr.com> wrote in message
    news:PI6dncXcTYbddq-iRVn-hgspeakeasy.net...
    > I had this problem with an authentication page where authenticating the
    user
    > took a few seconds and I didn't want them to keep clicking. Basically you
    > have to do 2 things with 1 click... something to visually alter the
    screen,
    > and then handle the actual click in your c/vb.net code.
    >
    > Make a javascript block to do whatever you need to do on the client when
    > they click the button. In the example, js renders the button "hidden".
    >
    > <Script Language="JavaScript">
    > function clickHandler()
    > {
    > frmLogin.btnLogin.style.visibility = 'hidden';
    > }
    > </Script>
    >
    > In my html, here's the submit button the user clicks:
    >
    > <form ID="frmLogin" runat="server">
    > <asp:Button ID="btnLogin" class="button" text="Log In"
    > onclick="Login_Click" Runat="server" />
    > </form>
    >
    > Now in Sub page_load, you need a call to RegisterOnSubmitStatement. This,
    > afaik, tells asp.net to run the js function specified then handle the
    click
    > event in asp.net:
    >
    > Sub Page_Load(s As Object, e As EventArgs)
    > RegisterOnSubmitStatement("submit", "clickHandler();")
    > '...code
    >
    > So when the user clicks btnLogin on my form, RegisterOnSubmitStatement
    calls
    > the javascript that hides the button, and then my vb.net routine called
    > "Login_Click" would run. 2 routines for the price of 1 click.
    >
    > You can augment the functionality of the clickHandler(); js routine to
    > display a please wait message, etc. Just don't damage the integrity of
    the
    > button object from the js code or the codebehind handling the button event
    > may fail. For example, I believe this code breaks if you 'disable' the
    > button or remove it completely. Hiding it is safe, and certainly renders
    > the button un-clickable for the remainder of the page life.
    >
    > HTH
    >
    >
    > "Matt" <metalrocks.com> wrote in message
    > news:sim5jvk0oeaidumhcs8hrsch9gj1mj81rh4ax.com...
    > > Hello,
    > >
    > > In an aspx page i have webform with some textboxes and a simple
    > > button. When the button is clicked, there is a postback and then the
    > > code in the click event of the button is executed.
    > >
    > > However in this code (click event of the button), i'm processing an
    > > online payment, which takes about 5 seconds. While waiting for the
    > > payment to be processed, the user can click again on the button, and
    > > this is what i want to block. I want to disable the button once
    > > clicked, and then execute the code for the web payment.
    > >
    > > However when we disable a button in the Load event, the page is only
    > > displayed after the Unload event, so the button still appears as
    > > enabled when executing the code in the click event of the button.
    > >
    > > I tried to call a javascript function on the onclick of the button to
    > > disable it but i get a compilation error at runtime. Is there a way to
    > > disable a webform button when clicked, then execute the code on the
    > > Click event of this button? The button needs to appear as disabled on
    > > the page before the code is executed.
    > >
    > > Thanks for any help!
    >
    >

    MS News \(MS ILM\) Guest

  2. #2

    Default Re: Tricky postback

    Got it. Sorry I did not provide the Login_Click Sub in code Behind

    "MS News (MS ILM)" <sql_agentmanhotmail.com> wrote in message
    news:ujSbfzdXDHA.1680tk2msftngp13.phx.gbl...
    > I tried to run your code and I am getting errors
    > 'ASP.WebForm1_aspx' does not contain a definition for 'Login_Click'
    >
    > ???
    >
    > "eruess" <eruessr.com> wrote in message
    > news:PI6dncXcTYbddq-iRVn-hgspeakeasy.net...
    > > I had this problem with an authentication page where authenticating the
    > user
    > > took a few seconds and I didn't want them to keep clicking. Basically
    you
    > > have to do 2 things with 1 click... something to visually alter the
    > screen,
    > > and then handle the actual click in your c/vb.net code.
    > >
    > > Make a javascript block to do whatever you need to do on the client when
    > > they click the button. In the example, js renders the button "hidden".
    > >
    > > <Script Language="JavaScript">
    > > function clickHandler()
    > > {
    > > frmLogin.btnLogin.style.visibility = 'hidden';
    > > }
    > > </Script>
    > >
    > > In my html, here's the submit button the user clicks:
    > >
    > > <form ID="frmLogin" runat="server">
    > > <asp:Button ID="btnLogin" class="button" text="Log In"
    > > onclick="Login_Click" Runat="server" />
    > > </form>
    > >
    > > Now in Sub page_load, you need a call to RegisterOnSubmitStatement.
    This,
    > > afaik, tells asp.net to run the js function specified then handle the
    > click
    > > event in asp.net:
    > >
    > > Sub Page_Load(s As Object, e As EventArgs)
    > > RegisterOnSubmitStatement("submit", "clickHandler();")
    > > '...code
    > >
    > > So when the user clicks btnLogin on my form, RegisterOnSubmitStatement
    > calls
    > > the javascript that hides the button, and then my vb.net routine called
    > > "Login_Click" would run. 2 routines for the price of 1 click.
    > >
    > > You can augment the functionality of the clickHandler(); js routine to
    > > display a please wait message, etc. Just don't damage the integrity of
    > the
    > > button object from the js code or the codebehind handling the button
    event
    > > may fail. For example, I believe this code breaks if you 'disable' the
    > > button or remove it completely. Hiding it is safe, and certainly
    renders
    > > the button un-clickable for the remainder of the page life.
    > >
    > > HTH
    > >
    > >
    > > "Matt" <metalrocks.com> wrote in message
    > > news:sim5jvk0oeaidumhcs8hrsch9gj1mj81rh4ax.com...
    > > > Hello,
    > > >
    > > > In an aspx page i have webform with some textboxes and a simple
    > > > button. When the button is clicked, there is a postback and then the
    > > > code in the click event of the button is executed.
    > > >
    > > > However in this code (click event of the button), i'm processing an
    > > > online payment, which takes about 5 seconds. While waiting for the
    > > > payment to be processed, the user can click again on the button, and
    > > > this is what i want to block. I want to disable the button once
    > > > clicked, and then execute the code for the web payment.
    > > >
    > > > However when we disable a button in the Load event, the page is only
    > > > displayed after the Unload event, so the button still appears as
    > > > enabled when executing the code in the click event of the button.
    > > >
    > > > I tried to call a javascript function on the onclick of the button to
    > > > disable it but i get a compilation error at runtime. Is there a way to
    > > > disable a webform button when clicked, then execute the code on the
    > > > Click event of this button? The button needs to appear as disabled on
    > > > the page before the code is executed.
    > > >
    > > > Thanks for any help!
    > >
    > >
    >
    >

    MS News \(MS ILM\) Guest

  3. #3

    Default Re: Tricky postback

    Login_Click is the name of a Sub in my code. You'll need to modify my post
    to have it function within your own project.
    >>When the button is clicked, there is a postback and then the
    code in the click event of the button is executed.
    However in this code (click event of the button), i'm processing an
    online payment, which takes about 5 seconds.<<

    So then instead of trying to call my Login_Click (which doesn't exist in
    your application) you'll want to call whatever sub does what you described
    in the above paragraph... 'Button1_Click' or whatever you / vs.net may have
    named it.

    Bear in mind with my project, Login_Click did not Handle any control events
    (such as clicking), and AutoEventWireUp was False. I have not tested this
    thing in a situation where I'm directly calling the sub that also handles
    the button's click.

    "MS News (MS ILM)" <sql_agentmanhotmail.com> wrote in message
    news:ujSbfzdXDHA.1680tk2msftngp13.phx.gbl...
    > I tried to run your code and I am getting errors
    > 'ASP.WebForm1_aspx' does not contain a definition for 'Login_Click'
    >
    > ???

    eruess Guest

  4. #4

    Default Re: Tricky postback

    Thanks, this is exactly what i was looking for! I also added some code
    in the javascript function to show a layer, containing a message and
    an animated gif acting like a progress bar.

    However the gif stops when the web payment code is executed, so the
    gif is useless. A flash animation works but i don't want to use flash
    in this project.

    But the essential is that it works, thanks!



    On Thu, 7 Aug 2003 17:14:13 -0700, "eruess" <eruessr.com> wrote:
    >I had this problem with an authentication page where authenticating the user
    >took a few seconds and I didn't want them to keep clicking. Basically you
    >have to do 2 things with 1 click... something to visually alter the screen,
    >and then handle the actual click in your c/vb.net code.
    >
    >Make a javascript block to do whatever you need to do on the client when
    >they click the button. In the example, js renders the button "hidden".
    >
    ><Script Language="JavaScript">
    > function clickHandler()
    > {
    > frmLogin.btnLogin.style.visibility = 'hidden';
    > }
    ></Script>
    >
    >In my html, here's the submit button the user clicks:
    >
    ><form ID="frmLogin" runat="server">
    > <asp:Button ID="btnLogin" class="button" text="Log In"
    >onclick="Login_Click" Runat="server" />
    ></form>
    >
    >Now in Sub page_load, you need a call to RegisterOnSubmitStatement. This,
    >afaik, tells asp.net to run the js function specified then handle the click
    >event in asp.net:
    >
    >Sub Page_Load(s As Object, e As EventArgs)
    > RegisterOnSubmitStatement("submit", "clickHandler();")
    > '...code
    >
    >So when the user clicks btnLogin on my form, RegisterOnSubmitStatement calls
    >the javascript that hides the button, and then my vb.net routine called
    >"Login_Click" would run. 2 routines for the price of 1 click.
    >
    >You can augment the functionality of the clickHandler(); js routine to
    >display a please wait message, etc. Just don't damage the integrity of the
    >button object from the js code or the codebehind handling the button event
    >may fail. For example, I believe this code breaks if you 'disable' the
    >button or remove it completely. Hiding it is safe, and certainly renders
    >the button un-clickable for the remainder of the page life.
    >
    >HTH
    >
    >
    >"Matt" <metalrocks.com> wrote in message
    >news:sim5jvk0oeaidumhcs8hrsch9gj1mj81rh4ax.com.. .
    >> Hello,
    >>
    >> In an aspx page i have webform with some textboxes and a simple
    >> button. When the button is clicked, there is a postback and then the
    >> code in the click event of the button is executed.
    >>
    >> However in this code (click event of the button), i'm processing an
    >> online payment, which takes about 5 seconds. While waiting for the
    >> payment to be processed, the user can click again on the button, and
    >> this is what i want to block. I want to disable the button once
    >> clicked, and then execute the code for the web payment.
    >>
    >> However when we disable a button in the Load event, the page is only
    >> displayed after the Unload event, so the button still appears as
    >> enabled when executing the code in the click event of the button.
    >>
    >> I tried to call a javascript function on the onclick of the button to
    >> disable it but i get a compilation error at runtime. Is there a way to
    >> disable a webform button when clicked, then execute the code on the
    >> Click event of this button? The button needs to appear as disabled on
    >> the page before the code is executed.
    >>
    >> Thanks for any help!
    >
    Matt Guest

  5. #5

    Default Re: Tricky postback

    Thank you, that is great

    "eruess" <eruessr.com> wrote in message
    news:NOCdnXbVIPeaaq6iRVn-iAspeakeasy.net...
    > Login_Click is the name of a Sub in my code. You'll need to modify my
    post
    > to have it function within your own project.
    >
    > >>When the button is clicked, there is a postback and then the
    > code in the click event of the button is executed.
    > However in this code (click event of the button), i'm processing an
    > online payment, which takes about 5 seconds.<<
    >
    > So then instead of trying to call my Login_Click (which doesn't exist in
    > your application) you'll want to call whatever sub does what you described
    > in the above paragraph... 'Button1_Click' or whatever you / vs.net may
    have
    > named it.
    >
    > Bear in mind with my project, Login_Click did not Handle any control
    events
    > (such as clicking), and AutoEventWireUp was False. I have not tested this
    > thing in a situation where I'm directly calling the sub that also handles
    > the button's click.
    >
    > "MS News (MS ILM)" <sql_agentmanhotmail.com> wrote in message
    > news:ujSbfzdXDHA.1680tk2msftngp13.phx.gbl...
    > > I tried to run your code and I am getting errors
    > > 'ASP.WebForm1_aspx' does not contain a definition for 'Login_Click'
    > >
    > > ???
    >
    >

    MS News \(MS ILM\) Guest

Similar Threads

  1. A Tricky One (well for me anyway)
    By DazFaz in forum Macromedia Flash Flashcom
    Replies: 0
    Last Post: November 2nd, 11:58 AM
  2. a tricky one...
    By Atmosfera in forum Macromedia Flash Data Integration
    Replies: 2
    Last Post: July 28th, 01:43 PM
  3. tricky rubber stamp
    By Carol_Chor@adobeforums.com in forum Adobe Photoshop Mac CS, CS2 & CS3
    Replies: 3
    Last Post: March 6th, 11:51 PM
  4. it's tricky!
    By ciecierega webforumsuser@macromedia.com in forum Macromedia Flash Sitedesign
    Replies: 0
    Last Post: November 10th, 03:18 PM
  5. A tricky one?
    By Jim Franklin in forum Microsoft Access
    Replies: 5
    Last Post: July 2nd, 06:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139