Visitors to VTC.com will be able to view all introductory videos for each training course.
Free Trial Members will gain access to first three chapters for each training course.
Full Access Members have full access to VTC.com�s entire library of video tutorials.
Now let's take a look at using a Trigger and keep in mind by Trigger we mean a control outside the UpdatePanel that causes the UpdatePanel to do it's magic. So what I'm going to do here is, I'm going to build on the example that I've been doing, the AJAX demo example and if you remember in an earlier video, we added the animated GIF for please wait and if I go back to the Source you can see where I was there and what I was working on but what I want to do now really is back to Design one more time, I want to add another button say right down here that's clearly outside the UpdatePanel and whenever I click that button and notice it's Button 2, notice it's outside the UpdatePanel, there's the Closing Tag for the UpdatePanel. Here's my Update Progress and here is that second button down there but when I click this I want it to cause the contents in the UpdatePanel to update. So what I'm going to do here is put me a Tag inside my UpdatePanel called Triggers. Okay. And then inside that Triggers Element I want to put a, notice I'm going to call ASP noticed Asynch PostBack. So I'm calling an Asynch PostBack Trigger and I'm going to pass it the ControlID notice I could also use an Event Name but I'm going to pass it the ControlID Button 2. Then I'll just close that down. So there you go, there is the Asynch Trigger okay, there my green line went away, it's finally saw my termination thing. Now so what's going to happen here is when I click this, it's going to jump up here and say hey, wait a minute, this one's cool, kick this stuff off. I need to also go to my Code Behind Page okay and on the Button 2 I need to put some code in. So I'm going to go back to Design, double-click on this button to get the Click Event and I want to put basically the same code that I had coming off, of Button 1. So when I call Button 2 then this is going to tell it to do an Asynchronous Call as part of that Update Control. Okay. So let's go see if it's working? See if I've done everything like I should. So this is going to open up and you notice if I run this one I get the Wait Button and it's going to update the time right here. Now this button is outside the UpdatePanel but when I click it notice I get the Wait Button and it's going to update the time right here. I'm going to click it again and you'll notice I can still work in my text box as it's updating. So that's a Trigger and that is allowing the functionality inside the UpdatePanel to be called from or triggered from outside on Button 2 down here alright. So that's the concept of Triggers. A few more things you can do with those, that's the basics for now, go out and code these up yourself and play with them and you can see some other things you can make happen. Pretty magic stuff.
| Course: | Designing and Developing ASP.NET 4 Web Apps (Exam 70-519) |
| Author: | Mark Long |
| SKU: | 34292 |
| ISBN: | 978-1-61866-029-9 |
| Release Date: | 2011-12-31 |
| Duration: | 8.5 hrs / 108 lessons |
| Work Files: |
Yes |
| Captions: | No |
| Compatibility: |
Vista/XP/2000, OS X, Linux QuickTime 7, Flash 8 |