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

Way to stop server action after javascript alert

P: n/a
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
Share this Question
Share on Google+
3 Replies


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

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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.