Solved

disable auto postback event on button submit in asp.net

Posted on 2007-04-02
3
3,345 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Developer tools in browsers have been around for a while, yet they are still heavily underused by developers. Developers still fix html or CSS then refresh page to see effect, or they put alert or debugger in JavaScript and then try again and again …
These days, all we hear about hacktivists took down so and so websites and retrieved thousands of user’s data. One of the techniques to get unauthorized access to database is by performing SQL injection. This article is quite lengthy which gives bas…
This video teaches users how to migrate an existing Wordpress website to a new domain.
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

679 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