?
Solved

ASP.NET Postback process

Posted on 2014-11-12
6
Medium Priority
?
108 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
Learn how to optimize MySQL for your business need

With the increasing importance of apps & networks in both business & personal interconnections, perfor. has become one of the key metrics of successful communication. This ebook is a hands-on business-case-driven guide to understanding MySQL query parameter tuning & database perf

 

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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
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 …
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…
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.

777 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