Solved

ASP.NET Postback process

Posted on 2014-11-12
6
107 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 17

Expert Comment

by:OriNetworks
ID: 40437946
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
ID: 40438019
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
ID: 40438037
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
Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

 

Author Comment

by:metro156
ID: 40438067
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
ID: 40438125
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
ID: 40441289
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

New Relic: Our company recently started researching several products to figure out what were the best ways for us to increase our web page speed and to quickly identify performance problems that we may be having. One of the products we evaluated wa…
Thoughout my experience working on eCommerce web applications I have seen applications succumbing to increased user demand and throughput. With increased loads the response times started to spike, which leads to user frustration and lost sales. I ha…
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 choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

724 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