OnClick

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.
 
K

Kevin Spencer

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top