OnClick

  • Thread starter Thread starter Ron
  • Start date Start date
R

Ron

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:LoginDialog id="cntLoginDialog"
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(object sender, System.EventArgs e)
{
if (Verifier.Verify(username, passowrd) == false)
{
// don't do the round trip
return;
}

Response.Redirect();
}

Only if the user name and the password are correct.
 
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
http://www.takempis.com
Neither a follower nor a lender be.
 
Back
Top