- LinkedIn Tips For Programmers
- Debugging Software
- Why Is It Called “Inversion of Control”?
- SpecFlow Tutorial
- The Parable of The Road Line Painter
- Setting up SpecFlow
- Code Comments & Agile Programming
- Cracking the Programmer’s Interview Code
- Run NUnit from Visual Studio
- TDD Gamification – Turning Test Driven Development into a Game
- How to Become a Better Programmer
- Limiting Beliefs of Programmers
- Node.js Tools For Visual Studio
- 100% Code Coverage Possible?
DotNetNuke - Data Access Layer Alternative
Distributed VS Server Based Version Control Systems
DotNetNuke Skinning - Containers
Do Programmers even NEED a degree?
Reflection and Interfaces
Finding a CSS Class Definition
CSharp fixed keyword
ASP.NET Cross Domain Form Submission
What is SpecFlow…
VB.NET - Char from String with Option Strict
Prevent Postback on Buttons
You can also get the feed via email. Sign up now by supplying your email address and clicking the Subscribe button
Over the weekend I got a question about how to prevent postbacks on buttons from within jQuery tabs. But the question really isn’t specific to jQuery. There are other times when you might not want a button to post back. So how do you do this?
There are several ways you might accomplish this depending on what your goal is.
The first, and most obvious choice, is to not use an ASP:Button control and use an HTML input type=”button” tag instead. This will allow you to have full control over what is happening on the client side. If at all possible, this should be your first choice.
<input type="button" value="button name" />
If that doesn’t work for you, then you can make use of the OnClientClick property of the ASP:Button control (this also works for other controls that post back)
Other Articles about Preventing PostBack on Buttons
Disable a submit button during Post Back. – C#, ASP.Net, VB.Net – Most of the programmers facing the issue of, how to handle multiple button submits by user at the same time. This article will help you with a small s.
Prevent page postback on enter key press in textbox in asp-net web pag – The asp.net button control has been rendered with “submit” type, which is the reason of page postback when enter key is pressed in any of the …
dotNETspidor: Prevent page postback on enter key press in textbox … – We looked at two ways to prevent page postback on enter-key press in a textbox in asp.net web page. Both the techniques work well. But I would prefer the first one since this would save the extra client side manipulations in the user’s …
Like this Article? Subscribe to get every article sent to your email.
- Tab Control ActiveTabIndex Lost on Postback I just got off the phone with a client who is using the MS-AJAX TabControl in one of his applications and any time he causes a postback, the tab resets to the first tab. If you've never […]
- WinForms – Change The Active Tab This question came in last Friday: I'm trying to code a windows form in vb.net 2005. In my form I have 2 TabControls and a command button. The button is in the first TabControl, so what […]
- Initializing An Array inline This is part two of the discussion I started yesterday about the StackOverflowException, where I explained how memory gets allocated for the different types of variables we have in our […]
- AjaxToolKit TabControl Disabled Tab I just finished an interesting project that involved the AjaxToolKit's Tab control. The first part of my assignment was to make the Tabs start about 160 pixels to the right of the left […]
- Upload a File via WebRequest Using CSharp I got this question a couple of weeks ago but just never had the time to put into answering fully. But today I have some extra time due to the fact that I’m under-booked with […]