Solved

disable auto postback event on button submit in asp.net

Posted on 2007-04-02
3
3,335 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
Comment Utility
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
Comment Utility
try
button.attributes.add("onClick", "return false;");)
0
 
LVL 25

Accepted Solution

by:
dstanley9 earned 500 total points
Comment Utility
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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
How to trouble shoot .net contact form 3 30
Azure Web App - See files 3 21
Where to begin studying? 5 63
asp.net mvc5 3 35
Introduction (All good things must come to an end (http://en.wikipedia.org/wiki/All_Good_Things...)) The original MySQL API (http://php.net/manual/en/book.mysql.php) has gone away, deprecated by PHP in Version 5.5, and removed from PHP in all curre…
Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now