Solved

ASP.NET Postback process

Posted on 2014-11-12
6
99 Views
Last Modified: 2014-11-15
What controls can cause a PostBack for an ASP.NET Page? And do these control(s) have the AutoPostback property?
What events associated with a control can cause a PostBack?
0
Comment
Question by:metro156
  • 3
  • 3
6 Comments
 
LVL 17

Expert Comment

by:OriNetworks
Comment Utility
Just about any control that the user can interact with will usually cause a postback if an event is wired to that control including invisible controls and custom controls. It is also possible to initiate a postback with javascript on behalf of a control. Not all controls support the AutoPostback property. You can view a list of .net WebControls at http://msdn.microsoft.com/en-us/library/System.Web.UI.WebControls(v=vs.110).aspxhttp://msdn.microsoft.com/en-us/library/System.Web.UI.WebControls(v=vs.110).aspx
0
 

Author Comment

by:metro156
Comment Utility
I just noticed there is no AutoPostBack property listed when you select a button control properties.
However, I see UseSubmitBehavior property on a button control which submits no matter if the property is False or True.
So apparently all buttons cause submit. There also must be a way to prevent a button from submitting to the server and
use the client side code. (jQuery)

See article on usesubmitbehavior
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.button.usesubmitbehavior(v=vs.110).aspx

This article below talks about the AutoPostBack property
http://www.c-sharpcorner.com/uploadfile/2f73dd/what-is-postback-in-Asp-Net/
0
 
LVL 17

Expert Comment

by:OriNetworks
Comment Utility
UseSubmitBehavior will still postback to the server but controls if it acts as a form submit button. to prevent a .net button from causing a postback you can use the OnClientClick property
OnClientClick="return false;"

Open in new window


Is there something specific you were trying to accomplish that still is not working?
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:metro156
Comment Utility
The OnClientClick property --- I do not see that property listed in the properties window when I select the button control.
Why is that?
0
 
LVL 17

Accepted Solution

by:
OriNetworks earned 500 total points
Comment Utility
I'm not sure what software you are using and that is outside the scope of this question but it is listed for the Button control in visual studio.

In summary, the microsoft reference will list all webcontrols and if they support the autopostback property and any event wired to a server side control may postback to the server including simple javascript. If you are trying to prevent a button from posting back, the OnClientClick property will let you override its default behavior by using return false.
0
 

Author Comment

by:metro156
Comment Utility
Ok I did find the OnClientClick property. So that answers that.  You have indicated if there is an event handler tied to that
control, you will be able to postback.  
However, that would require the AutoPostBack property of that control to be set to True, correct?
If you set the control's AutoPostBAck property to False, then the control would not cause a postback  even though
you tied an event handler to it, correct?
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Timeout Expired 2 91
multi page pdf 4 69
use of cookies and regulations 1 51
Problem to file 3 47
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…
This video teaches users how to migrate an existing Wordpress website to a new domain.

743 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

15 Experts available now in Live!

Get 1:1 Help Now