Exploring the depths and potentials of ASP.NET RSS 2.0 or Subscribe to .BenRush by Email
 Tuesday, June 06, 2006

If you look back on one of my previous posts on the UpdatePanel, you'll see that I cover a function called __doPostBack() located deep within the Atlas clientside framework. This is a very important method as it is not only the method that begins the partial postback sequence for Atlas controls, but also something that you can call yourself to programmatically cause a partial postback via javascript. __doPostBack() simply takes an eventTarget and eventArgument as parameters, detects if a partial postback is already occuring and, if not, sets appropriate form values (like _EVENTTARGET, _EVENTARGUMENT) that are used by the ASP.Net server runtime and then initiates a partial postback. The postback proceeds as if it were initiated by the eventArgument (which should be a reference to a HTML control on the page), like thus:

__doPostBack('<%= Button_Search.ClientID %>','');

If Button_Search's "Click" event were registered as a trigger for an UpdatePanel on your page, the UpdatePanel will refresh itself just as if you clicked the button manually (with your mouse). If you wanted to have an UpdatePanel that refreshed only programmatically, you could have a hidden button input field on your form and set it up as a trigger. The bottom line is that if you want to programmatically initiate a partial postback or to programmatically refresh and UpdatePanel, do so by calling __doPostBack().

Now, why would you want to do something like this? Under what circumstances would this be important? One instance that comes to mind immediately is having a child window refresh contents of a parent window, or to refresh contents of an UpdatePanel when a modal dialog closes, etc. All of these instances are not ones that are easily catchable from the Atlas framework alone, and so may require coding on your part. Many other situations probably exist out there.

For purposes of academia, here is the code for __doPostBack(); note that the rabbit hole of code contines at _onFormSubmit, but this is details you really ought to not care about in this situation:

this._doPostBack = function(eventTarget, eventArgument) {
   _additionalInput = null;

   if (this.get_inPostBack()) {
      if (window.event) {
         window.event.returnValue = false;
      }
      return;
   }

   _postbackSettings = null;
   var postbackElement = findNearestElement(eventTarget);
   if (postbackElement) {
      _postbackSettings = getPostbackSettings(postbackElement);
   }
   else {
      _postbackSettings = createPostbackSettings(true, _scriptManagerID);
   }
   if (!_postbackSettings.async) {
      _originalDoPostBack(eventTarget, eventArgument);
      return;
   }

   var form = _form;
   form.__EVENTTARGET.value = eventTarget;
   form.__EVENTARGUMENT.value = eventArgument;
   this._onFormSubmit();

   if (window.event) {
      window.event.returnValue = false;
   }
}


kick it on DotNetKicks.com
Tuesday, June 06, 2006 5:10:47 PM (Central Standard Time, UTC-06:00)  #    Comments [2] - Trackback
Computing
Tracked by:
http://freewebs.com/aspxfaq/08/sitemap19.html [Pingback]
http://freewebs.com/toltom/12/sitemap12.html [Pingback]
http://freewebs.com/toltom/09/thrifty.html [Pingback]
http://freewebs.com/toltom/06/sitemap5.html [Pingback]
http://freewebs.com/toltom/03/jenna-jameson.html [Pingback]
"http://fartooblog.tripod.com/66.html" (http://fartooblog.tripod.com/66.html) [Pingback]
"http://fartooblog.tripod.com/51.html" (http://fartooblog.tripod.com/51.html) [Pingback]
"http://pmbqoa.org/sitemap29.html" (http://pmbqoa.org/sitemap29.html) [Pingback]
"http://apz50e.org/locey-realty.html" (http://apz50e.org/locey-realty.html) [Pingback]
"http://topslots.nl.eu.org/15/sitemap7.html" (http://topslots.nl.eu.org/15/sitem... [Pingback]
"http://freewebs.com/amexa/42/http-www-cheap-air-com.html" (http://freewebs.com/... [Pingback]
"http://freewebs.com/amexa/30/wilson-daily-times.html" (http://freewebs.com/amex... [Pingback]
"http://freewebs.com/amexa/41/madison-square-garden-seating.html" (http://freewe... [Pingback]
"http://pinofranc.homestead.com/01/better-investing.html" (http://pinofranc.home... [Pingback]
"http://pinofranc.homestead.com/03/limousine.html" (http://pinofranc.homestead.c... [Pingback]
"http://pinofranc.homestead.com/01/second-wind-air-purifiers.html" (http://pinof... [Pingback]
"http://polxl-xxx.com/secretaries-in-sexy-stockings.html" (http://polxl-xxx.com/... [Pingback]
"http://z0poi-www.com/sex-69.html" (http://z0poi-www.com/sex-69.html) [Pingback]
"http://gacmuunews.angelfire.com/7.html" (http://gacmuunews.angelfire.com/7.html... [Pingback]
"http://freewebs.com/madfeenews/171.html" (http://freewebs.com/madfeenews/171.ht... [Pingback]
"http://tadviinews.angelfire.com/66.html" (http://tadviinews.angelfire.com/66.ht... [Pingback]
"http://nbn6i-ooo.com/gay-nude-beach.html" (http://nbn6i-ooo.com/gay-nude-beach.... [Pingback]
"http://gacmuunews.angelfire.com/89.html" (http://gacmuunews.angelfire.com/89.ht... [Pingback]
"http://smp6f-hhh.com/velvet-revolver-dirty-little-thing.html" (http://smp6f-hhh... [Pingback]
"http://xxx3t-xxx.biz/youngest-legal-pussy.html" (http://xxx3t-xxx.biz/youngest-... [Pingback]
"http://bzsna-www.biz/bizarre-anal.html" (http://bzsna-www.biz/bizarre-anal.html... [Pingback]
"http://c5cza-eee.com/sex-pain.html" (http://c5cza-eee.com/sex-pain.html) [Pingback]
"http://freewebs.com/bermut/00/blue-cross-blue-shield-mississippi.html" (http://... [Pingback]
"http://freewebs.com/tiltak/01/anthony.html" (http://freewebs.com/tiltak/01/anth... [Pingback]
"http://freewebs.com/amexa/40/texas-board-of-insurance.html" (http://freewebs.co... [Pingback]
"http://freewebs.com/lcddlp/01/houses-for-rent.html" (http://freewebs.com/lcddlp... [Pingback]
"http://freewebs.com/tiltak/03/locks.html" (http://freewebs.com/tiltak/03/locks.... [Pingback]
"http://u1eah-rrr.com/tight-pants-camel-toe.html" (http://u1eah-rrr.com/tight-pa... [Pingback]
"http://unistarkom.ueuo.com/00554-blog.html" (http://unistarkom.ueuo.com/00554-b... [Pingback]
"http://ramambo.nl.eu.org/11/georgia-map.html" (http://ramambo.nl.eu.org/11/geor... [Pingback]
"http://harum.nl.eu.org/weightloss-com.html" (http://harum.nl.eu.org/weightloss-... [Pingback]
"http://harum.nl.eu.org/waterworks-com.html" (http://harum.nl.eu.org/waterworks-... [Pingback]
"http://nfdi1ek.biz/massive-fake-boobs.html" (http://nfdi1ek.biz/massive-fake-bo... [Pingback]
"http://ri9spbn.biz/young-child.html" (http://ri9spbn.biz/young-child.html) [Pingback]
"http://fanton.nl.eu.org/chicago-city-colleges.html" (http://fanton.nl.eu.org/ch... [Pingback]
"http://weroblog.nl.eu.org/big-phat-ass-butt.html" (http://weroblog.nl.eu.org/bi... [Pingback]
"http://srykwzw.biz/cable-virtual.html" (http://srykwzw.biz/cable-virtual.html) [Pingback]
"http://freewebs.com/gabeganews/53.html" (http://freewebs.com/gabeganews/53.html... [Pingback]
"http://reto--blog.nl.eu.org/hear-an-orgasm.html" (http://reto--blog.nl.eu.org/h... [Pingback]
"http://heroblog.nl.eu.org/lesbians-licking-vaginas.html" (http://heroblog.nl.eu... [Pingback]
"http://gre--blog.nl.eu.org/climbto350.html" (http://gre--blog.nl.eu.org/climbto... [Pingback]
"http://coppohq.biz/human-resource-jobs.html" (http://coppohq.biz/human-resource... [Pingback]
"http://nasferablog.netfirms.com/34.html" (http://nasferablog.netfirms.com/34.ht... [Pingback]
"http://cypvori.biz/wwws-publicdebt-treas-gov.html" (http://cypvori.biz/wwws-pub... [Pingback]
"http://nasferablog.netfirms.com/19.html" (http://nasferablog.netfirms.com/19.ht... [Pingback]
"http://wovd0yo.biz/skimpy-bikini.html" (http://wovd0yo.biz/skimpy-bikini.html) [Pingback]
"http://viuqnvu.biz/strip-poker-games.html" (http://viuqnvu.biz/strip-poker-game... [Pingback]
"http://mdvcjaj.biz/motorcycle-insurance-quotes.html" (http://mdvcjaj.biz/motorc... [Pingback]
"http://hadfet--loto.nl.eu.org/residence-inn-las-vegas.html" (http://hadfet--lot... [Pingback]
"http://nasferablog.netfirms.com/32.html" (http://nasferablog.netfirms.com/32.ht... [Pingback]
"http://jmqp7tr.biz/texaslootery.html" (http://jmqp7tr.biz/texaslootery.html) [Pingback]
"http://wwad6lf.biz/chervrolet.html" (http://wwad6lf.biz/chervrolet.html) [Pingback]
"http://derfoblog.ifrance.com/sitemap3.html" (http://derfoblog.ifrance.com/sitem... [Pingback]
"http://freewebs.com/sruone/learners-permit-test.html" (http://freewebs.com/sruo... [Pingback]
"http://freewebs.com/sruone/sitemap32.html" (http://freewebs.com/sruone/sitemap3... [Pingback]
"http://kipoertaf.homestead.com/47.html" (http://kipoertaf.homestead.com/47.html... [Pingback]
"http://fm7fgw1.info/www-wolverineaccess-umich-edu.html" (http://fm7fgw1.info/ww... [Pingback]
"http://freewebs.com/vuter/00/bentley.html" (http://freewebs.com/vuter/00/bentle... [Pingback]
"http://euter.homestead.com/00/amana-com.html" (http://euter.homestead.com/00/am... [Pingback]
"http://freewebs.com/vuter/00/sitemap8.html" (http://freewebs.com/vuter/00/sitem... [Pingback]
"http://duter.homestead.com/01/washington-dc-com.html" (http://duter.homestead.c... [Pingback]
"http://freewebs.com/datingblogger/1003.html" (http://freewebs.com/datingblogger... [Pingback]
"http://freewebs.com/datingblogger/1048.html" (http://freewebs.com/datingblogger... [Pingback]
"http://fasxen.netfirms.com/18.html" (http://fasxen.netfirms.com/18.html) [Pingback]

Computers Blogs - Blog Top Sites

Archive
<July 2009>
SunMonTueWedThuFriSat
2829301234
567891011
12131415161718
19202122232425
2627282930311
2345678
Blogroll
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2009
Benjamin Rush
Sign In
Statistics
Total Posts: 444
This Year: 0
This Month: 0
This Week: 0
Comments: 128
Themes
Pick a theme:
All Content © 2009, Benjamin Rush
DasBlog theme 'Business' created by Christoph De Baene (delarou)