473,395 Members | 1,999 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Clint side and server side event


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
4 1294
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
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

12
by: HarveyB | last post by:
I would like to generate non-modal popup windows from ASP.Net code-behind. I have tried using Client Side scripting like "function Test(){ window.open('test.htm',_blank,...
1
by: Stephen | last post by:
Hey Everyone, I have a problem with a web application due to the use of both client-side and server side script on the on-click event of a button. The client side script runs first as expected...
1
by: Stephen | last post by:
Hey All, I have a problem with a web application due to the use of both client-side and server side script on the on-click event of a button. The client side script runs first as expected however...
3
by: Reetu | last post by:
Hi All, I have an html button on .aspx page. <INPUT class="sbttn" id="btnComplete0" onclick="onComplete ()" type="button" value="Mark Completed" name="btnComplete0"> When the user clicks...
1
by: Jim Hammond | last post by:
I can get data from a client-side assembly to the server in two manual steps, but I need to be able to do it in one step. Step 1: The user presses the manually coded "Step 1" button, which calls...
3
by: Borr | last post by:
Hi, I have an ASP .NET page, that runs client side timer that does something on the Server side and after that loads another page. So I have on client side something like : function...
1
by: vidya | last post by:
Hi, I have a button which is a web control. I have some validation in javascript for the button in .aspx file and some in the button onclick event in code behind(C#). I need to get through both...
6
by: den 2005 | last post by:
Hi everybody, Question 1: How do you set the values from server-side to a client-side control or how do you execute a javascript function without a button click event? Question 2: How do you...
1
by: susikto chaudhuri | last post by:
Hi, I have created a server response page (written in PHP). This is receiving the response from the server and writing into a text file. What I want to do when I will get the response from the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.