473,511 Members | 16,660 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Way to stop server action after javascript alert

I have a javascript checking on a search button which is used to check if the
dummy value is inputted before the search button is clicked.
===============================================
butSearch.Attributes.Add("onclick", "if (document.forms[0],txt_dummy.value
== '') alert('Please input dummy number.');")
==========================================

the button control must be runat server as i'll need to do a sqldb search
after the dummy value is inputted.
================================================
Private Sub butSearch_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles butSearch.Click
================================================

so that is the button i'm using
================================================
<asp:button id="butSearch" runat="server" Width="76px"
Text="Submit"></asp:button>
================================================

Any idea to stop the server postback action after the javascript checked an
error ?

pls help
Nov 19 '05 #1
3 2071
try the following

butSearch.Attributes.Add("onclick", "if (document.forms[0],txt_dummy.value
== ''){ alert('Please input dummy number.'); return false;}")
--
Jason Brown
Microsoft GTSC, IIS

This posting is provided "AS IS" with no warranties, and confers no rights.

"Maverick" <Ma******@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
I have a javascript checking on a search button which is used to check if
the
dummy value is inputted before the search button is clicked.
===============================================
butSearch.Attributes.Add("onclick", "if (document.forms[0],txt_dummy.value
== '') alert('Please input dummy number.');")
==========================================

the button control must be runat server as i'll need to do a sqldb search
after the dummy value is inputted.
================================================
Private Sub butSearch_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles butSearch.Click
================================================

so that is the button i'm using
================================================
<asp:button id="butSearch" runat="server" Width="76px"
Text="Submit"></asp:button>
================================================

Any idea to stop the server postback action after the javascript checked
an
error ?

pls help

Nov 19 '05 #2
Hi,

You can use "Autopostback=false" attribute in <asp:Button> tag.

Hope, this helps you.

Thanks & Regards
Vadivel Kumar

"Maverick" <Ma******@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
I have a javascript checking on a search button which is used to check if
the
dummy value is inputted before the search button is clicked.
===============================================
butSearch.Attributes.Add("onclick", "if (document.forms[0],txt_dummy.value
== '') alert('Please input dummy number.');")
==========================================

the button control must be runat server as i'll need to do a sqldb search
after the dummy value is inputted.
================================================
Private Sub butSearch_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles butSearch.Click
================================================

so that is the button i'm using
================================================
<asp:button id="butSearch" runat="server" Width="76px"
Text="Submit"></asp:button>
================================================

Any idea to stop the server postback action after the javascript checked
an
error ?

pls help

Nov 19 '05 #3
Exactly what i want ...
thx ~~~

"Jason Brown [MSFT]" wrote:
try the following

butSearch.Attributes.Add("onclick", "if (document.forms[0],txt_dummy.value
== ''){ alert('Please input dummy number.'); return false;}")
--
Jason Brown
Microsoft GTSC, IIS

This posting is provided "AS IS" with no warranties, and confers no rights.

"Maverick" <Ma******@discussions.microsoft.com> wrote in message
news:A2**********************************@microsof t.com...
I have a javascript checking on a search button which is used to check if
the
dummy value is inputted before the search button is clicked.
===============================================
butSearch.Attributes.Add("onclick", "if (document.forms[0],txt_dummy.value
== '') alert('Please input dummy number.');")
==========================================

the button control must be runat server as i'll need to do a sqldb search
after the dummy value is inputted.
================================================
Private Sub butSearch_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles butSearch.Click
================================================

so that is the button i'm using
================================================
<asp:button id="butSearch" runat="server" Width="76px"
Text="Submit"></asp:button>
================================================

Any idea to stop the server postback action after the javascript checked
an
error ?

pls help


Nov 19 '05 #4

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

Similar topics

6
11649
by: Baffin Shea | last post by:
Dear All, I am a beginner in javascript and looking for help, I put the following script in the original.asp: function NewWindows() { window.open("abc.asp", "new") }
3
1185
by: Ian Richardson | last post by:
I have some example code below where, when I click on the background of the table I want one thing to happen (wilma), and when I click on the text box I want one different thing to happen (fred). ...
8
2019
by: Eric Osman | last post by:
My javascript program has reason to want to stop. For example, function A has 5 lines, the second of which calls function B, which has 5 lines, the first of which calls function C. But...
10
6591
by: iam247 | last post by:
Hi In my prototype asp page (with no javascript and no password validation, I have a registration form with the following action: <form name="form" method="post" action="RegDetails.asp"> ...
1
2553
by: almarc | last post by:
Problem : Stop an "Unonlaod" when then confirmation is false. Is a really good script but i have just one problem. The problem that i have is when i click on a link. The scipt ask "Do you want to...
6
2518
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...
3
2065
by: rolf.oltmans | last post by:
Hello, I've been trying to access the html element "Body" in my server side code. I've searched the archives of this group and have been able to put together an example that doesn't work :)...
8
2011
by: Richard Maher | last post by:
Hi, I am in a mouseup event for button A and I'd like to disable=false button B before starting some work. Is there anyway that an event for button B can then fire before my event processing for...
3
3588
by: graphicssl | last post by:
Okay, so first of all, I'm a designer first and a light coder second (I'm only really trained with HTML and CSS). So I apologize for having to post about something that's probably super-trivial! ...
0
7138
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
7355
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,...
1
5066
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4737
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3225
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3213
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1576
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
781
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
447
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.