Exploring the depths and potentials of ASP.NET RSS 2.0 or Subscribe to .BenRush by Email
 Monday, May 15, 2006

I'm going to continue digging into the UpdatePanel control since the last post I made on this subject, so if you haven't read it, I would recommend doing so first...

The UpdatePanel is a wonderful utility for quickly taking a non-Atlas'ized ASP.Net website and Atlas'izing it, as it empowers you to simply surround traditional controls with <atlas:UpdatePanel> tags to enable them for partial postbacks. However, UpdatePanels can be somewhat misleading too: most people fail to realize (at least I did at first) that the UpdatPanel itself does not post back to the server, instead it is updated on the client using clever DHTML tricks (all controls within an UpdatePanel are surrounded, on the client, by either a span or div tag which is easily identified and whose children are easily over-written and modified). What actually posts back to the server is the PageRequestManager control script which is aided by the dealings of the ScriptManager control on the server. This simple fact - that the UpdatePanel doesn't post back - is important to realize, especially when one begins to think in terms of setting up triggers to update the content of the UpdatePanel. It becomes more of a mindset shift, really...but one that's important to make....let me explain...

Triggers are client-side controls that give developers the ability to say, basically, "I want the content of the UpdatePanel to refresh when such-n-such happens". Out of the box, Atlas comes with two types of triggers: a ControlEventTrigger and a ControlValueTrigger, which "trigger" the update of the UpdatePanel when either a clientside event occurs (button click, etc.) or value changes (text box content) respectively. Asigning triggers to an UpdatePanel is simple and is done like the following:

            <atlas:UpdatePanel runat="server" ID="UpdatePanel3" Mode="Conditional">
                <Triggers>
                    <atlas:ControlEventTrigger ControlID="btnTrigger" EventName="Click" />
                </Triggers>
                <ContentTemplate>
                    <asp:Label runat="server" ID="lblTime2" /><br />
                </ContentTemplate>
            </atlas:UpdatePanel>

...Note the <Triggers></Triggers> tags and the encapsulated instance of the <atlas:ControlEventTrigger>. Again, what this says to the Atlas runtime is that when the control btnTrigger is Click'd that the UpdatePanel ought to have its controls refreshed. Since the <Triggers> control exists "within" the UpdatePanel control (parent/child relationship in the XML), you can see how one would think the UpdatePanel is responsible for doing all clientside postbacks. The result of thinking this way would lead you to think you could simply point to any control you wanted and hook any event you wanted and the UpdatePanel will blindly post back for you, updating the content. The truth is, however, that the UpdatePanel relies on other controls to start the postback sequence in motion; this postback sequence gets "intercepted" by the Atlas clientside framework and re-submitted as a specially formatted postback (for the Atlas serverside framework to deal with). So, let me reiterate this fact: the control that has the trigger attached must initiate the postback!

Why is this important? If the control doesn't start a postback on its own then 1) the browser won't try to postback, 2) the clientside framework won't intercept the postback event, and 3) the framework won't be able to re-submit the post as a partial one and allow the serverside framework to take over, and so forth. As programmatic proof, take a gander at this XML Script statement declaring the PageRequestManager on a page with UpdatePanels and triggers for those panels:

<script type="text/xml-script">
<page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
  <components>
    <pageRequestManager id="_PageRequestManager" updatePanelIDs="Panel1,Panel2,Panel3" asyncPostbackControlIDs="AsyncPostBackButton,Panel3bButton" scriptManagerID="TheScriptManager" form="form1" />
  </components>
</page></script> 

Note the instance of the _PageRequestManager object of type pageRequestManager above between the <components> tags. It has a property, asyncPostbackControlIDs, whose value is a comma-delimited array of control names who, you guessed it, have triggers assigned to them from within UpdatePanels. When an event that triggers a postback is fired on the page, it goes through the follow method at one point in the client code base:

this._doPostBack = function(eventTarget, eventArgument) {
   ...
   _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;
   }
}

The _postbackSettings.async property holds a boolean value stating with (True) the control is flagged for partial postbacks or (False) it's not. A status of True is given to any clientside control within an UpdatePanel or pointed to by a trigger from within an UpdatePanel. If this boolean switch is False, then an old-style postback occurs (refreshing the entire page), else the _onFormSubmit method is called which spawns an asynchronous postback to the server, etc.

One final question exists, however - and that's how does the <PageRequestManager> gets its property values? Or, who sets the asyncPostbackControlIDs property on the <PageRequestManager> object for the page? The answer is the ScriptManager control when it renders on the server. After this control's PreRendering phase on the server, it calls the following method which, as you can see at the end, is responsible for setting the property names and values (the values were built using StringBuilder objects):

private void RenderPageRequestManager(ScriptTextWriter writer)
{
   GenericScriptComponent component1 = new GenericScriptComponent(new ScriptTypeDescriptor("pageRequestManager", ScriptNamespace.Default));
   component1.ID = ScriptManager.PageRequestManagerID;
   StringBuilder builder1 = new StringBuilder();
   if (this._allUpdatePanels != null)
   {
      for (int num1 = 0; num1 < this._allUpdatePanels.Count; num1++)
      {
         ...
         builder1.Append(",");
         ...
         builder1.Append(this._allUpdatePanels[num1].UniqueID);
      }
   }
   StringBuilder builder2 = new StringBuilder();
   if (this._asyncPostbackControls != null)
   {
      for (int num2 = 0; num2 < this._asyncPostbackControls.Count; num2++)
      {
         ...
         builder2.Append(",");
         ...
         builder2.Append(this._asyncPostbackControls[num2].ClientID);
      }
   }
   component1.AddValueProperty("updatePanelIDs", builder1.ToString());
   component1.AddValueProperty("asyncPostbackControlIDs", builder2.ToString());
   component1.AddValueProperty("scriptManagerID", this.UniqueID);
   component1.AddValueProperty("form", this._page.Form.ClientID);
   ...
}

Each trigger adds an entry for itself in theScriptManager's _asyncPostBackControls array when the control is being built and each trigger is being initialized on the server by its UpdatePanel.


kick it on DotNetKicks.com
Monday, May 15, 2006 1:14:02 AM (Central Standard Time, UTC-06:00)  #    Comments [0] - Trackback
Computing
Tracked by:
"Programmatically or Manually refreshing an UpdatePanel from javascript" (IBenRu... [Trackback]
http://www.ben-rush.net/blog/PermaLink,guid,fc045fba-5e26-4ed7-9d3d-dad9e907c185... [Pingback]
http://www.google.com/search?q=hqkyakcs [Pingback]
http://circuslabs.co.za/newsletter/attachments/valium.htm [Pingback]
http://thesneeze.com/mt-archives/old/buycheapphentermine.htm [Pingback]
http://stylishwebs.com/ads/images/tramadolbuy.htm [Pingback]
http://rdsblog.info/center/cache/orderorderviagra.htm [Pingback]
http://webimageintl.com/cache/cialis.htm [Pingback]
http://icebox.com/catalog/images/diazepam.htm [Pingback]
http://cuteberries.com/cbmakers/Unique/valium.htm [Pingback]
"zyban side affects" (zyban side affects) [Trackback]
http://peroxidecomics.com/archives/buytramadol.htm [Pingback]
http://nextday.co.nz/images/old/cheappropecia.htm [Pingback]
http://webimageintl.com/cache/buyviagraonline.htm [Pingback]
http://ramw.org/img/upload/adipex.htm [Pingback]
http://www.allknightaccess.com/betatesting/transcode/buycialisonline.htm [Pingback]
"www.best-vaporizers.com" (www.best-vaporizers.com) [Trackback]
"downlineincome.com" (downlineincome.com) [Trackback]
"www.pokerplayersusa.com" (www.pokerplayersusa.com) [Trackback]
"www.mommyco.com" (www.mommyco.com) [Trackback]
"www.cannabisvaporizers.com" (www.cannabisvaporizers.com) [Trackback]
"www.feminizedmarijuanaseeds.com" (www.feminizedmarijuanaseeds.com) [Trackback]
"www.bewbs.com" (www.bewbs.com) [Trackback]
"www.impact210.com" (www.impact210.com) [Trackback]
"hackgs.com" (hackgs.com) [Trackback]
"www.neptunesbeachclub.com" (www.neptunesbeachclub.com) [Trackback]
"www.conferencecalldirectory.net" (www.conferencecalldirectory.net) [Trackback]
"www.ringtone-center.com" (www.ringtone-center.com) [Trackback]
"www.herbalmarijuanavaporizer.com" (www.herbalmarijuanavaporizer.com) [Trackback]
"www.marijuanavaporizers.net" (www.marijuanavaporizers.net) [Trackback]
"www.herbvaporizers.com" (www.herbvaporizers.com) [Trackback]
"www.marijuanavapor.com" (www.marijuanavapor.com) [Trackback]
"www.vaporizerpipes.com" (www.vaporizerpipes.com) [Trackback]
"www.jntah.com" (www.jntah.com) [Trackback]
"phenterminedietpill.fugocm.pila.pl" (phenterminedietpill.fugocm.pila.pl) [Trackback]
"www.thecodingmaster.com" (www.thecodingmaster.com) [Trackback]
"www.ben-rush.net" (www.ben-rush.net) [Trackback]
http://rexhotelvietnam.com/images/old/cheapgenericcialis.htm [Pingback]
http://ramw.org/img/upload/ultram.htm [Pingback]
"flagyl side effects how long" (flagyl side effects how long) [Trackback]
"birdhouse distributors" (birdhouse distributors) [Trackback]
"ital" (ital) [Trackback]
"business cards" (business cards) [Trackback]
"foto scolaretta sex sex" (foto scolaretta sex sex) [Trackback]
"bed and breakfast positano" (bed and breakfast positano) [Trackback]
"crochet pillow edgings" (crochet pillow edgings) [Trackback]
"prom dresses" (prom dresses) [Trackback]
"blue cross of ca" (blue cross of ca) [Trackback]
"mouse pad" (mouse pad) [Trackback]
"plants retail frisco%2c tx" (plants retail frisco%2c tx) [Trackback]
"invisibile ragazze inculate" (invisibile ragazze inculate) [Trackback]
"piu caldo fuoriclasse papa" (piu caldo fuoriclasse papa) [Trackback]
"altro consumo it" (altro consumo it) [Trackback]
"lake compounce" (lake compounce) [Trackback]
"amateur adult mpeg archives" (amateur adult mpeg archives) [Trackback]
"nokia 1110" (nokia 1110) [Trackback]
"Antivirus Software Reviews" (Antivirus Software Reviews) [Trackback]
"car seat covers dog" (car seat covers dog) [Trackback]
"what is my computer hz" (what is my computer hz) [Trackback]
"girls gone wild" (girls gone wild) [Trackback]
"volagratis" (volagratis) [Trackback]
"song lyrics riding dirty" (song lyrics riding dirty) [Trackback]
"owner builder homes" (owner builder homes) [Trackback]
"handsome teen scopata" (handsome teen scopata) [Trackback]
"fast weight loss wellbutrin" (fast weight loss wellbutrin) [Trackback]
"citizen wrist watch" (citizen wrist watch) [Trackback]
"ragazza ginevra" (ragazza ginevra) [Trackback]
"girls ugly" (girls ugly) [Trackback]
"cpa client newsletters" (cpa client newsletters) [Trackback]
http://theorderoftime.com/game/wiki/images/dietpillsphentermine.htm [Pingback]
http://angliangardener.co.uk/furniture/cheaptramadol.htm [Pingback]
http://climatechange.com.au/forum/images/avatars/ultram.htm [Pingback]
http://rdsblog.info/center/cache/ordercialis.htm [Pingback]
http://spaceblue.com/lists/attachments/buygenericviagra.htm [Pingback]
http://rightrainbow.com/archives/2004/propecia.htm [Pingback]
http://spaceblue.com/lists/attachments/buyambien.htm [Pingback]
http://miresearch.org/files/cheapphentermine.htm [Pingback]
http://net-commish.com/images/dietpillphentermine.htm [Pingback]
http://suburbanblight.net/archives/images/aboutphentermine.htm [Pingback]
http://leasefunders.com/resources/orderphentermineonline.htm [Pingback]
http://isaschools.org/jm/publish/ativan.htm [Pingback]
http://folkalliance.org.au/db_backup/onlinepharmacy.htm [Pingback]
http://www.promisesproject.org/counter/database/fioricet.htm [Pingback]
http://www.promisesproject.org/counter/database/viagra.htm [Pingback]
http://everyskyline.com/blog/files/whatisultram.htm [Pingback]
http://everyskyline.com/blog/files/levitra.htm [Pingback]
http://www.olhausenbilliards.com/images/accessorieslarge/ambien.htm [Pingback]
http://eclectics.com/guestbooks/templates/prescription-phentermine.htm [Pingback]
http://flyouth.org/singapore/data/phentermine.htm [Pingback]
http://rss-world.info/info/viagra.htm [Pingback]
http://rss-world.info/info/tramadol.htm [Pingback]
http://paigemaguire.com/albums/viagrasale.htm [Pingback]
http://astro-tom.com/alascripts/alachat/data/prescriptionphentermine.htm [Pingback]
http://www.olhausenbilliards.com/images/accessorieslarge/fioricet.htm [Pingback]
http://freewebs.com/aspxfaq/02/sitemap20.html [Pingback]
http://freewebs.com/toltom/03/index.html [Pingback]
http://freewebs.com/toltom/05/lower-back-pain.html [Pingback]
http://freewebs.com/toltom/03/sitemap4.html [Pingback]
http://freewebs.com/toltom/03/airtrans-com.html [Pingback]
"http://fartooblog.tripod.com/111.html" (http://fartooblog.tripod.com/111.html) [Pingback]
"http://fartooblog.tripod.com/110.html" (http://fartooblog.tripod.com/110.html) [Pingback]
"http://esrdwu.org/sitemap4.html" (http://esrdwu.org/sitemap4.html) [Pingback]
"http://klpzop.org/tampon-sex.html" (http://klpzop.org/tampon-sex.html) [Pingback]
"http://topslots.nl.eu.org/11/index.html" (http://topslots.nl.eu.org/11/index.ht... [Pingback]
"http://freewebs.com/amexa/21/notre-dame-high-school-belmont.html" (http://freew... [Pingback]
"http://freewebs.com/amexa/39/x-men-the-last-stand-after-the-credits.html" (http... [Pingback]
"http://freewebs.com/amexa/35/baltimore.html" (http://freewebs.com/amexa/35/balt... [Pingback]
"http://pinofranc.homestead.com/00/harris-county-department-of-education.html" (... [Pingback]
"http://pinofranc.homestead.com/00/texas-road-house.html" (http://pinofranc.home... [Pingback]
"http://pinofranc.homestead.com/00/technical-schools-in-new-york.html" (http://p... [Pingback]
"http://vyb6o-xxx.com/xxx-sex-porn.html" (http://vyb6o-xxx.com/xxx-sex-porn.html... [Pingback]
"http://rxfac-www.com/socks-sex.html" (http://rxfac-www.com/socks-sex.html) [Pingback]
"http://maoguunews.netfirms.com/12.html" (http://maoguunews.netfirms.com/12.html... [Pingback]
"http://tadviinews.angelfire.com/134.html" (http://tadviinews.angelfire.com/134.... [Pingback]
"http://pasbeenews.tripod.com/155.html" (http://pasbeenews.tripod.com/155.html) [Pingback]
"http://lkhhy-ooo.com/bouncing-boobs.html" (http://lkhhy-ooo.com/bouncing-boobs.... [Pingback]
"http://nabkoonews.tripod.com/163.html" (http://nabkoonews.tripod.com/163.html) [Pingback]
"http://njq8l-hhh.com/hip-hop-honeys-nude.html" (http://njq8l-hhh.com/hip-hop-ho... [Pingback]
"http://hdwkw-xxx.biz/android-18-hentai.html" (http://hdwkw-xxx.biz/android-18-h... [Pingback]
"http://ncier-www.biz/the-incredibles-naked.html" (http://ncier-www.biz/the-incr... [Pingback]
"http://p4g2f-eee.com/mature-nude-jpg.html" (http://p4g2f-eee.com/mature-nude-jp... [Pingback]
"http://freewebs.com/bermut/10/http-www-google-earth-com.html" (http://freewebs.... [Pingback]
"http://freewebs.com/retuv/13/truck-driving-schools.html" (http://freewebs.com/r... [Pingback]
"http://freewebs.com/niret/09/tyra-banks-wallpaper.html" (http://freewebs.com/ni... [Pingback]
"http://freewebs.com/rimoq/00/mass-lottery.html" (http://freewebs.com/rimoq/00/m... [Pingback]
"http://freewebs.com/gremi/07/heard-em-say-252209.html" (http://freewebs.com/gre... [Pingback]
"http://tixpf-rrr.com/sexual-pokemon-fiction.html" (http://tixpf-rrr.com/sexual-... [Pingback]
"http://unibetkom.load4.net/00215-blog.html" (http://unibetkom.load4.net/00215-b... [Pingback]
"http://ramambo.nl.eu.org/12/amhfcu.html" (http://ramambo.nl.eu.org/12/amhfcu.ht... [Pingback]
"http://harum.nl.eu.org/christina-model.html" (http://harum.nl.eu.org/christina-... [Pingback]
"http://harum.nl.eu.org/manor-care.html" (http://harum.nl.eu.org/manor-care.html... [Pingback]
"http://grgh1aa.biz/www-aadvantage25-com.html" (http://grgh1aa.biz/www-aadvantag... [Pingback]
"http://ow1njsa.biz/comcast-sports.html" (http://ow1njsa.biz/comcast-sports.html... [Pingback]
"http://xw6t8yk.com/xxxcartoons.html" (http://xw6t8yk.com/xxxcartoons.html) [Pingback]
"http://meritblog.nl.eu.org/dwight-d-eisenhower.html" (http://meritblog.nl.eu.or... [Pingback]
"http://alo--fokom.nl.eu.org/mark-williams.html" (http://alo--fokom.nl.eu.org/ma... [Pingback]
"http://nasferablog.netfirms.com/25.html" (http://nasferablog.netfirms.com/25.ht... [Pingback]
"http://qwe--blog.nl.eu.org/free-nude-models.html" (http://qwe--blog.nl.eu.org/f... [Pingback]
"http://cyisevw.com/www-nfips2-com.html" (http://cyisevw.com/www-nfips2-com.html... [Pingback]
"http://uykrmbb.biz/leg-sex.html" (http://uykrmbb.biz/leg-sex.html) [Pingback]
"http://zuro--blog.nl.eu.org/wet-slit.html" (http://zuro--blog.nl.eu.org/wet-sli... [Pingback]
"http://nasferablog.netfirms.com/373.html" (http://nasferablog.netfirms.com/373.... [Pingback]
"http://lk2iuen.biz/pregnant-pee.html" (http://lk2iuen.biz/pregnant-pee.html) [Pingback]
"http://nasferablog.netfirms.com/349.html" (http://nasferablog.netfirms.com/349.... [Pingback]
"http://vot--kom.nl.eu.org/www-affnet-com.html" (http://vot--kom.nl.eu.org/www-a... [Pingback]
"http://rea--kom.nl.eu.org/teeniemovies.html" (http://rea--kom.nl.eu.org/teeniem... [Pingback]
"http://hane--lono.nl.eu.org/netzero.html" (http://hane--lono.nl.eu.org/netzero.... [Pingback]
"http://gqkkthz.biz/wayne-community-college.html" (http://gqkkthz.biz/wayne-comm... [Pingback]
"http://nasferablog.netfirms.com/320.html" (http://nasferablog.netfirms.com/320.... [Pingback]
"http://zf1y1fs.biz/hyundi.html" (http://zf1y1fs.biz/hyundi.html) [Pingback]
"http://wwad6lf.biz/myrtlebeacg.html" (http://wwad6lf.biz/myrtlebeacg.html) [Pingback]
"http://freewebs.com/fremapblog/sitemap4.html" (http://freewebs.com/fremapblog/s... [Pingback]
"http://freewebs.com/sruone/ben--jerrys.html" (http://freewebs.com/sruone/ben--j... [Pingback]
"http://freewebs.com/sruone/sitemap393.html" (http://freewebs.com/sruone/sitemap... [Pingback]
"http://lopbafrea.homestead.com/150.html" (http://lopbafrea.homestead.com/150.ht... [Pingback]
"http://aqupofot.nl.eu.org/morongo.html" (http://aqupofot.nl.eu.org/morongo.html... [Pingback]
"http://freewebs.com/vuter/06/cerebal-palsy.html" (http://freewebs.com/vuter/06/... [Pingback]
"http://euter.homestead.com/00/fast-food-calories.html" (http://euter.homestead.... [Pingback]
"http://euter.homestead.com/01/sitemap11.html" (http://euter.homestead.com/01/si... [Pingback]
"Programming Tutorials" (Programming Tutorials) [Trackback]
"http://auter.homestead.com/01/www-north-west-airlines-com.html" (http://auter.h... [Pingback]
"http://freewebs.com/datingblogger/1770.html" (http://freewebs.com/datingblogger... [Pingback]
"http://freewebs.com/datingblogger/891.html" (http://freewebs.com/datingblogger/... [Pingback]
"__doPostBack fails when __EVENTTARGET is specified" (ASP.NET AJAX Forum Posts) [Trackback]
"http://fasxen.netfirms.com/27.html" (http://fasxen.netfirms.com/27.html) [Pingback]
"Software Development Guide" (Software Development Guide) [Trackback]
"Top Internet Business" (Top Internet Business) [Trackback]
"Website Templates and Web Design, Graphic Layouts" (Website Templates and Web D... [Trackback]
"Online Dating Site Reviews" (Online Dating Site Reviews) [Trackback]
Name
E-mail
Home page

Comment (HTML not allowed)  

Enter the code shown (prevents robots):

Live Comment Preview

Computers Blogs - Blog Top Sites

Archive
<January 2009>
SunMonTueWedThuFriSat
28293031123
45678910
11121314151617
18192021222324
25262728293031
1234567
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)