Clint side and server side event

  • Thread starter Thread starter WilsonSmith
  • Start date Start date
W

WilsonSmith

Hello All,

My development environment is as follows:

ASP.Net App with .Net Framework 1.1 with VB.net



I have added the code in the page load event for non post back activity.

MyButton.Attributes("onclick") = "javascript:return confirm('You
will loose all data. Do you want to continue?');"

When the user clicks on MyButton and chose "Cancel" button, still the
MyButton clicked event is getting called at the server side. I want to call
this server side code only when the user selects OK button.

What is wrong in the code?

Wilson
 
Get rid of the server side event - and do a Form.submit on the if(confirm)



Hello All,

My development environment is as follows:

ASP.Net App with .Net Framework 1.1 with VB.net



I have added the code in the page load event for non post back activity.

MyButton.Attributes("onclick") = "javascript:return confirm('You
will loose all data. Do you want to continue?');"

When the user clicks on MyButton and chose "Cancel" button, still the
MyButton clicked event is getting called at the server side. I want to call
this server side code only when the user selects OK button.

What is wrong in the code?

Wilson

Bobby Ryzhy
bobby @ domain below
http://weekendtech.net
 
This syntax works for me:
btn.Attributes.Add("OnClick","return confirm('Delete?');")
 
Same code is not working for me.

Somehow the page is getting resubmitted when the user selects OK or Cancel
button.

My code was like this

btn.Attributes.Add("OnClick","return confirm('Delete?');")

Today I am noticing it is not working.

I don't know why?

Wilson.
 
Back
Top