Solved

disable auto postback event on button submit in asp.net

Posted on 2007-04-02
3
3,343 Views
Last Modified: 2008-01-09
Hi currently I am using asp.net 2.0 and c# language and sql server 2005 as database server

On page load event I am retrieving values from db and displaying it on form text box.
On button click event I have made database connectivity and storing value of textbox in database.
But when I am doing edition in textbox and going to save those updates. Then it will show values in textbox without modification of contents.

When I am using asp.net button it will automatically take autopostback event true.
I have read somewhere that we can disable it using html button but.......
If I am using html button then .net and sql database connectivity is not working in it.
I just want to disable autopostback event......

Thanks in advance
0
Comment
Question by:dotsandcoms
3 Comments
 
LVL 4

Expert Comment

by:coesy
ID: 18835507
But you need the postback in order to process your database stuff, the postback is what allows the onclick event of the button.
0
 
LVL 5

Expert Comment

by:jef06
ID: 18835510
try
button.attributes.add("onClick", "return false;");)
0
 
LVL 25

Accepted Solution

by:
dstanley9 earned 500 total points
ID: 18836163
Is sounds like you just need to load the data on the first call, not on postback.  If so use this in Form_Load:

if(!IsPostBack)
{
  // load data
}
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (May 2015) This web page has appeared at Google.  It's definitely worth considering! https://www.google.com/about/careers/students/guide-to-technical-development.html How to Know You are Making a Difference at EE In August, 2013, one …
Using Quotation Marks in PHP This question (http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/Q_28217211.html) seems to come up a lot for developers who are new to PHP.  And it got me thinking, "How can we explain the rule…
Wufoo.com provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to selectively show certain fields based on user input using rules to gather relevant information and data from your forms. The rules feature provides you with an opportunity…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question