473,386 Members | 1,763 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,386 software developers and data experts.

ASP.Net questions

If you have a client-side script that catches an event for a control, and a
server-side script that catches the same event, which event will fire first?
The reason I ask is I want a button that will do some data validation on the
server, and possibly run some client script to open another window when the
validation fails.

I could be looking into this the wrong way. I am definately open to
suggestions, so any help that you can give would be greatly appreciated.

Thanks,

Jeremy Ames
Nov 15 '05 #1
4 1190
The client goes first. If the client doesn't cancel the submit event, then
there is a post to the server, and the server runs.

It doesn't sound like you have client side validation. You have server side
validation, which should then generate a client side script, which would
open a new window in case of failure (this might be just calling some
predefined javascript function).

If you think about how web page work, the client makes a request, the server
processes it and sends a response. When you click on a button, the client
sends another request to the server. So the client has a chance to process
that button click event before sending the request to the server - but after
the request is sent, it is too late. The event is gone, and a brand new page
has been generated. So there is no way for the server to process the event,
and then the client. The closest you can do is have the server generate
client side script to make something else happen.

"Jeremy Ames" <yo******@here.com> wrote in message
news:eJ**************@tk2msftngp13.phx.gbl...
If you have a client-side script that catches an event for a control, and a server-side script that catches the same event, which event will fire first? The reason I ask is I want a button that will do some data validation on the server, and possibly run some client script to open another window when the validation fails.

I could be looking into this the wrong way. I am definately open to
suggestions, so any help that you can give would be greatly appreciated.

Thanks,

Jeremy Ames

Nov 15 '05 #2
If I generate client side script, wouldn't it run every time the page is
reloaded after the script is added?

"Marina" <so*****@nospam.com> wrote in message
news:em*************@TK2MSFTNGP10.phx.gbl...
The client goes first. If the client doesn't cancel the submit event, then
there is a post to the server, and the server runs.

It doesn't sound like you have client side validation. You have server side
validation, which should then generate a client side script, which would
open a new window in case of failure (this might be just calling some
predefined javascript function).

If you think about how web page work, the client makes a request, the server
processes it and sends a response. When you click on a button, the client
sends another request to the server. So the client has a chance to process
that button click event before sending the request to the server - but after
the request is sent, it is too late. The event is gone, and a brand new page
has been generated. So there is no way for the server to process the event,
and then the client. The closest you can do is have the server generate
client side script to make something else happen.

"Jeremy Ames" <yo******@here.com> wrote in message
news:eJ**************@tk2msftngp13.phx.gbl...
If you have a client-side script that catches an event for a control, and a server-side script that catches the same event, which event will fire first? The reason I ask is I want a button that will do some data validation on the server, and possibly run some client script to open another window when the validation fails.

I could be looking into this the wrong way. I am definately open to
suggestions, so any help that you can give would be greatly appreciated.

Thanks,

Jeremy Ames


Nov 15 '05 #3
Since the page is recreated on every single request, then no. It will only
be there when the page streams it down. The times it doesn't write it out -
it won't be there.

"Jeremy Ames" <yo******@here.com> wrote in message
news:Oo*************@TK2MSFTNGP11.phx.gbl...
If I generate client side script, wouldn't it run every time the page is
reloaded after the script is added?

"Marina" <so*****@nospam.com> wrote in message
news:em*************@TK2MSFTNGP10.phx.gbl...
The client goes first. If the client doesn't cancel the submit event, then there is a post to the server, and the server runs.

It doesn't sound like you have client side validation. You have server side validation, which should then generate a client side script, which would
open a new window in case of failure (this might be just calling some
predefined javascript function).

If you think about how web page work, the client makes a request, the server processes it and sends a response. When you click on a button, the client
sends another request to the server. So the client has a chance to process that button click event before sending the request to the server - but after the request is sent, it is too late. The event is gone, and a brand new page has been generated. So there is no way for the server to process the event, and then the client. The closest you can do is have the server generate
client side script to make something else happen.

"Jeremy Ames" <yo******@here.com> wrote in message
news:eJ**************@tk2msftngp13.phx.gbl...
If you have a client-side script that catches an event for a control,
and a
server-side script that catches the same event, which event will fire

first?
The reason I ask is I want a button that will do some data validation on

the
server, and possibly run some client script to open another window when

the
validation fails.

I could be looking into this the wrong way. I am definately open to
suggestions, so any help that you can give would be greatly appreciated.

Thanks,

Jeremy Ames


Nov 15 '05 #4
Could you give me an example of how to add the script to the page?

"Marina" <so*****@nospam.com> wrote in message
news:eX**************@TK2MSFTNGP12.phx.gbl...
Since the page is recreated on every single request, then no. It will only
be there when the page streams it down. The times it doesn't write it out -
it won't be there.

"Jeremy Ames" <yo******@here.com> wrote in message
news:Oo*************@TK2MSFTNGP11.phx.gbl...
If I generate client side script, wouldn't it run every time the page is
reloaded after the script is added?

"Marina" <so*****@nospam.com> wrote in message
news:em*************@TK2MSFTNGP10.phx.gbl...
The client goes first. If the client doesn't cancel the submit event, then there is a post to the server, and the server runs.

It doesn't sound like you have client side validation. You have server side validation, which should then generate a client side script, which would
open a new window in case of failure (this might be just calling some
predefined javascript function).

If you think about how web page work, the client makes a request, the server processes it and sends a response. When you click on a button, the client
sends another request to the server. So the client has a chance to process that button click event before sending the request to the server - but after the request is sent, it is too late. The event is gone, and a brand new page has been generated. So there is no way for the server to process the event, and then the client. The closest you can do is have the server generate
client side script to make something else happen.

"Jeremy Ames" <yo******@here.com> wrote in message
news:eJ**************@tk2msftngp13.phx.gbl...
If you have a client-side script that catches an event for a control,
and a
server-side script that catches the same event, which event will fire

first?
The reason I ask is I want a button that will do some data validation on

the
server, and possibly run some client script to open another window when

the
validation fails.

I could be looking into this the wrong way. I am definately open to
suggestions, so any help that you can give would be greatly appreciated.

Thanks,

Jeremy Ames



Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: softwareengineer2006 | last post by:
All Interview Questions And Answers 10000 Interview Questions And Answers(C,C++,JAVA,DOTNET,Oracle,SAP) I have listed over 10000 interview questions asked in interview/placement test papers for...
0
by: connectrajesh | last post by:
INTERVIEWINFO.NET http://www.interviewinfo.net FREE WEB SITE AND SERVICE FOR JOB SEEKERS /FRESH GRADUATES NO ADVERTISEMENT
2
by: freepdfforjobs | last post by:
Full eBook with 4000 C#, JAVA,.NET and SQL Server Interview questions http://www.questpond.com/SampleInterviewQuestionBook.zip Download the JAVA , .NET and SQL Server interview sheet and rate...
4
by: Drew | last post by:
I posted this to the asp.db group, but it doesn't look like there is much activity on there, also I noticed that there are a bunch of posts on here pertaining to database and asp. Sorry for...
8
by: Krypto | last post by:
Hi, I have used Python for a couple of projects last year and I found it extremely useful. I could write two middle size projects in 2-3 months (part time). Right now I am a bit rusty and trying...
0
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
1
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
0
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
0
by: reema | last post by:
EJB Interview Questions http://interviewdoor.com/technical/EJB-Interview-Questions.htm CSS Interview Questions http://interviewdoor.com/technical/CSS-Interview-Questions.htm C Interview Questions...
0
by: reema | last post by:
EJB Interview Questions http://interviewdoor.com/technical/EJB-Interview-Questions.htm CSS Interview Questions http://interviewdoor.com/technical/CSS-Interview-Questions.htm C Interview Questions...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.