By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,247 Members | 1,018 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,247 IT Pros & Developers. It's quick & easy.

Clint side and server side event

P: n/a

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
Nov 18 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Get rid of the server side event - and do a Form.submit on the if(confirm)

On Fri, 16 Jul 2004 14:38:55 -0700, "WilsonSmith" <WS********@hotmail.com> wrote:

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
Nov 18 '05 #2

P: n/a
This syntax works for me:
btn.Attributes.Add("OnClick","return confirm('Delete?');")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"WilsonSmith" <WS********@hotmail.com> wrote in message
news:uy*************@tk2msftngp13.phx.gbl...

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

Nov 18 '05 #3

P: n/a
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.

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:eR**************@TK2MSFTNGP09.phx.gbl...
This syntax works for me:
btn.Attributes.Add("OnClick","return confirm('Delete?');")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"WilsonSmith" <WS********@hotmail.com> wrote in message
news:uy*************@tk2msftngp13.phx.gbl...

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


Nov 18 '05 #4

P: n/a
It looks like it is a bug in IE.
here is the link http://www.dotnet247.com/247referenc...51/258874.aspx

"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> wrote in message
news:eR**************@TK2MSFTNGP09.phx.gbl...
This syntax works for me:
btn.Attributes.Add("OnClick","return confirm('Delete?');")

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://Steve.Orr.net
"WilsonSmith" <WS********@hotmail.com> wrote in message
news:uy*************@tk2msftngp13.phx.gbl...

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


Nov 18 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.