OnClick

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ron

    #1

    OnClick

    I have created a 'LoginDialog ' user control with 'OK'
    and 'Cancel' buttons. Then I have included the control
    into a Web Form.

    <form id="Login" method="post" runat="server" onclick="">
    <div align="center">
    <uc1:LoginDialo g id="cntLoginDia log"
    runat="server"> </uc1:LoginDialog >
    </div>
    </form>


    The control buttons have OnClick event handler but I
    don't want the click event to initiate the round trip to
    the server. I want the cancel handler to clear the user
    name and password textboxes and the ok handler to
    explicitely initiate the round trip

    private void btOK_Click(obje ct sender, System.EventArg s e)
    {
    if (Verifier.Verif y(username, passowrd) == false)
    {
    // don't do the round trip
    return;
    }

    Response.Redire ct();
    }

    Only if the user name and the password are correct.
  • Kevin Spencer

    #2
    Re: OnClick

    How are you going to avoid a "round trip" (PostBack) from server-side code?
    The only way to execute that code is via PostBack!

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    All hotels in Benidorm. The best selection of Benidorm hotels with reviews and maps. Book in advance and save.

    Neither a follower nor a lender be.


    "Ron" <namortaror@hot mail.com> wrote in message
    news:07da01c366 a8$db430fd0$a10 1280a@phx.gbl.. .[color=blue]
    > I have created a 'LoginDialog ' user control with 'OK'
    > and 'Cancel' buttons. Then I have included the control
    > into a Web Form
    >
    > <form id="Login" method="post" runat="server" onclick="">
    > <div align="center">
    > <uc1:LoginDialo g id="cntLoginDia log"
    > runat="server"> </uc1:LoginDialog >
    > </div>
    > </form>
    >
    >
    > The control buttons have OnClick event handler but I
    > don't want the click event to initiate the round trip to
    > the server. I want the cancel handler to clear the user
    > name and password textboxes and the ok handler to
    > explicitely initiate the round trip
    >
    > private void btOK_Click(obje ct sender, System.EventArg s e)
    > {
    > if (Verifier.Verif y(username, passowrd) == false)
    > {
    > // don't do the round trip
    > return;
    > }
    >
    > Response.Redire ct();
    > }
    >
    > Only if the user name and the password are correct.[/color]


    Comment

    Working...