473,569 Members | 2,438 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Validation on javascript in button and post back if it returns true

4 New Member
I have textboxes and dropdownlist on my page. And i have image button when i click this image button i m validating textboxes on javascript and if it returns true, i need to do a post back to save the values. If it is returns false it should not post back.

Please do help me on this.
Sep 22 '10 #1
1 1688
ZiadElmalki
43 New Member
You can use the OnClientClick property. Return false to cancel the submit.

<asp:Button
runat="server"
Text="Ok"
OnClientClick=" javascript:retu rn confirm('Do you want to submit?');" />
Sep 23 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1302
by: Margaret | last post by:
I've got my forms more or less working - the login form now has a regular button instead of an asp:button, so I can attach the Window.Open call for the next page in the client code. I moved the validation for the login into Page_Load in an if (IsPostBack) statement. The problem now is timing. The login form isn't posting back - the new...
1
1820
by: Manan | last post by:
hello all, I have a simple question. on my .aspx page I have bunch of textbox, and dropdowns. One of the dropdown2 has postback = true. When the user selects an item, the brower will post back to the server. My problem is I only wants the browser will post back to the server if (textbox1, textbox2, and dropdown1) are not null values. I...
1
1079
by: John | last post by:
I have attached the java script code to Button web control as follows. myButton.Attributes.Add("OnClick", "OpenWindow()") I have written java script to open the window in the OpenWindow function. When I click on the myButon, new window will open and at the sametime button is posting back the form(?) and the main window comes up and the...
3
3089
by: Brian Henry | last post by:
I have two list boxes on my form... lstCanSend and lstRecipients... well then there are two buttons add and remove between them (your basic select and pick listing) which uses java script to move the items between list boxes (the listbox controls are server side ones with runat=server set on them, the buttons are basic html button i dont want...
1
1388
by: thomson | last post by:
Hi All, I do have a button control, which has a post back and has to do some server side validations also. I need to attach some client side scripting also , where it can be called only on the post back For eg: In the click of the server side control, i do some validations
6
3730
by: guoqi zheng | last post by:
In a regular html form, when user press "enter" key, the form will be submitted. However, in ASP.NET web form, a form will only be submitted (post back) when a special button is clicked. Many user get used to click "enter" key to submit a form. How can I use "enter" key to submit/postback in ASP.NET. Thank, Guoqi Zheng
2
1789
by: David Tilman | last post by:
I'm new to ASP .NET and have run into a problem. I have a child page open in a web application that the user adds information to and then clicks the save button. The information is added to a databse. If there is a problem with adding the record to the database, I want to display the error message on the page after post back from clicking the...
3
3283
by: Jeremy Chapman | last post by:
I've created a custom control which outputs html at runtime like <span id="controlid" value="myvalue"></span>. On my page I have javascript that changes the value of the value attribute. On post back I want to parse the html changed by the javascript and update a server side variable. I thought this could be done in by the adding...
2
4499
by: dustbort | last post by:
I recently had a problem where my required field validator stopped working. But, the page still posted back and tried to insert a record into the database without performing server-side validation. I discovered that there was no aspnet_client folder in the root of my IIS Web site, and when I ran "aspnet_regiis -c", client-side validation was...
2
2179
by: sunilthk | last post by:
Hi All, I have a question. If javascript is disabled how asp.net determines which control has caused the post back. As we know that when we clicks on the button the buttons name goes with posted data, so asp.net can detrmine which btn caused the post back. In case of dropdown lists(if auto post back is true) _doPostback javascript function...
0
7703
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7618
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8138
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7679
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5223
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3657
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2117
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 we have to send another system

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.