<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-6610419525310410391</id><updated>2011-11-27T15:36:44.727-08:00</updated><category term='clickonce'/><category term='search support'/><category term='page compilation model'/><category term='visual basic'/><category term='surfacing data'/><category term='creating xml'/><category term='modify database'/><category term='multiple selection controls'/><category term='localization'/><category term='coding standards'/><category term='flowlayout panel control'/><category term='events'/><category term='effects of caching'/><category term='network connectivity'/><category term='full text search'/><category term='site navigation'/><category term='datarepeater'/><category term='user defined functions'/><category term='events and postback'/><category term='codebehind'/><category term='non-host item classes'/><category term='tabpanel'/><category term='linq to xml'/><category term='inheritance'/><category term='user feedback'/><category term='entities'/><category term='deferred loading'/><category term='rss'/><category term='business analyst'/><category term='testing web applications'/><category term='load testing'/><category term='developer'/><category term='additions'/><category term='application lifecycle'/><category term='distributed load testing'/><category term='basics'/><category term='pagemethods'/><category term='querying'/><category term='update related tables'/><category term='xml intellisense'/><category term='linq'/><category term='error handling'/><category term='data model'/><category term='build interop user controls'/><category term='login portal'/><category term='streaming data files'/><category term='synchronization'/><category term='securing site'/><category term='query interceptors'/><category term='memory'/><category term='column data types'/><category term='themes'/><category term='word content controls'/><category term='filestream'/><category term='websites'/><category term='tester perspective'/><category term='splitcontainer control'/><category term='creating webform'/><category term='unit testing'/><category term='asp.net'/><category term='listview control'/><category term='framework'/><category term='excel spreadsheets'/><category term='toolstrip control'/><category term='json'/><category term='generic tests'/><category term='statusstrip control'/><category term='static parallel'/><category term='fileupload control'/><category term='introduction'/><category term='client'/><category term='updating database'/><category term='table valued parameters'/><category term='addins'/><category term='Pr:Daniel Moth'/><category term='unit tests'/><category term='querying stored procedures'/><category term='change tracking'/><category term='formview'/><category term='xml namespaces'/><category term='linqdatasource'/><category term='sharepoint'/><category term='lookup lists'/><category term='request pipeline'/><category term='linq to sql'/><category term='sql functions'/><category term='windows forms'/><category term='manual testing'/><category term='dialog box control'/><category term='personalization'/><category term='coded web tests'/><category term='windows media player control'/><category term='stylesheets'/><category term='membership'/><category term='test driven development'/><category term='services'/><category term='filter data'/><category term='web application state'/><category term='filter support'/><category term='backgroundworker control'/><category term='one to many forms'/><category term='processcontrol'/><category term='xml documents'/><category term='bug work item'/><category term='data driven'/><category term='stored procedures'/><category term='publish and analyze test results'/><category term='client application services'/><category term='silverlight'/><category term='howto'/><category term='build interop forms'/><category term='autocomplete'/><category term='custom linqdatasource'/><category term='create'/><category term='vb'/><category term='team system'/><category term='calendar control'/><category term='customize site'/><category term='notifyicon control'/><category term='parallel extensions'/><category term='ado.net'/><category term='ajax enable'/><category term='mobile development'/><category term='remote debugging'/><category term='sql'/><category term='ajax client'/><category term='task'/><category term='taskmanager'/><category term='data entry'/><category term='source code'/><category term='architect'/><category term='fullpost'/><category term='plinq'/><category term='caching'/><category term='writing'/><category term='ajax control toolkit'/><category term='debugging and tracing'/><category term='web development helper'/><category term='treeview control'/><category term='calendar'/><category term='continuous integration'/><category term='syndicating'/><category term='creating'/><category term='designing relational database tables'/><category term='gridview'/><category term='automated tests'/><category term='annotations'/><category term='simple object binding'/><category term='service operations'/><category term='ad rotator control'/><category term='experts'/><category term='login controls'/><category term='validation'/><category term='sql server 2005 express'/><category term='manipulating database data'/><category term='c#'/><category term='addin'/><category term='literal control'/><category term='multiview control'/><category term='visual web developer express'/><category term='popup'/><category term='timer control'/><category term='code coverage'/><category term='profiles'/><category term='code activity'/><category term='defining'/><category term='deploy local data'/><category term='one to many'/><category term='roles'/><category term='custom extraction rules'/><category term='contact us'/><category term='vb.net'/><category term='load test'/><category term='page lifecycle'/><category term='n-tier datasets'/><category term='print forms'/><category term='textboxwatermarkextender'/><category term='xml'/><category term='scriptmanagerproxy'/><category term='managing and running tests'/><category term='executing queries'/><category term='batch process excel files'/><category term='controls'/><category term='durable services'/><category term='tips and tricks'/><category term='security'/><category term='deploying web site'/><category term='dataset'/><category term='ScreenVideoPlayer'/><category term='asynchronous calls'/><category term='object binding'/><category term='visual studio'/><category term='webbrowser control'/><category term='load test agent'/><category term='metadata generation'/><category term='business intelligence development studio'/><category term='atom'/><category term='task parallel library'/><category term='testing'/><category term='code analysis'/><category term='architecture'/><category term='VSTO debugging'/><category term='updating'/><category term='uri'/><category term='picturebox control'/><category term='sql server management studio'/><category term='blogpost'/><category term='outlook mail item'/><category term='ajax business value'/><category term='workflow'/><category term='debugging'/><category term='menustrip control'/><category term='understand data'/><category term='timeouts'/><category term='http'/><category term='search form'/><category term='xml controls'/><category term='tables'/><category term='structured query language'/><category term='web forms user interface'/><category term='sql server 2008'/><category term='deploy hybrid applications'/><category term='transactions'/><category term='namespaces'/><category term='feedback'/><category term='reporting services'/><category term='linq querying'/><category term='training kit'/><category term='closed captioning'/><category term='web parts'/><category term='managed'/><category term='parallel linq'/><category term='vsto'/><category term='connect to database'/><category term='richtextbox control'/><category term='quiz engine'/><category term='sorting support'/><category term='wcf'/><category term='file dialog'/><category term='rss feed'/><category term='network file share'/><category term='visual studio 2008'/><category term='master pages'/><category term='ajax'/><category term='multilingual site'/><category term='records'/><category term='Pr:Mike Taulty'/><category term='format data'/><category term='create database'/><category term='mediasoundplayer'/><category term='scriptmanager'/><category term='user interface controls'/><category term='local data'/><category term='high volume'/><category term='objectcontext'/><category term='traffic footprint'/><category term='office 2007'/><category term='tablelayout control'/><category term='tab control'/><category term='windows workflow foundation'/><category term='button control'/><category term='sql data'/><category term='querying database'/><category term='custom activity'/><category term='data services'/><category term='effects of viewstate'/><category term='aggregate queries'/><category term='metadata'/><category term='profiling'/><title type='text'>A directory for screencasts</title><subtitle type='html'>Enabling searching of screencast content</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default?start-index=101&amp;max-results=100'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>724</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-3024972354304842298</id><published>2010-04-14T13:16:00.001-07:00</published><updated>2010-04-14T13:16:56.596-07:00</updated><title type='text'>Windows Presentation Foundation 4 Plumbing and Internals</title><content type='html'>&lt;span id="fullpost"&gt;&lt;br /&gt;        &lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105"&gt;Windows Presentation Foundation 4 Plumbing and Internals&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;span&gt;Come get the inside scoop on how Windows Presentation Foundation (WPF) powers all its rich services – like layout, databinding, and animation. There is a lot of heavy lifting done for you under the hood; in this session, we crack open these system components, including the trees (visual, logical, and inheritance), the property system and its change notification, and a few of the routing systems that all messages go through. Bring your hard-hat for this one!&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;iid=326"&gt;&lt;h2&gt;Initialization&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Demystifying the processes of initialization and binding.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;iid=327"&gt;&lt;h2&gt;Inheritance&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Logical and visual inheritance in WPF 4.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;iid=328"&gt;&lt;h2&gt;Responsiveness&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;How to improve application responsiveness in WPF 4.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;iid=329"&gt;&lt;h2&gt;Background Worker&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Moving tasks into the background.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;iid=330"&gt;&lt;h2&gt;Conclusion&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Other resources and a brief Q&amp;A session&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3087"&gt;&lt;h2&gt;00:00:00&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;Welcome to session WPF4 Plumbing and Internals, we'll be diving into it shortly, but, this is the last day of PDC. Have you gotten a lot out of it so far? Fantastic!&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3088"&gt;&lt;h2&gt;00:00:11&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;Wide awake? I know it is a tough time slot at least I didn't have the first thing in the morning on the final day. That can be really rough.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3089"&gt;&lt;h2&gt;00:00:18&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;My name is Blake Stone, I'm an architect here at Microsoft, working on a wide variety of .NET things. Really happy to be able to talk to you about the wpf side of things today. But when we thought about plumbing and internals, there are a couple of ways to go about a subject like this.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3090"&gt;&lt;h2&gt;00:00:35&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;One of them is to really dive in and tell you all of the inside scoop. How all the comments are writtin in iambic pentameter. How every single variable has to rhyme with some other variable in the same file. But those are the kinds of things that are interesting to us, so the poetry of wpf will have to remain hidden for now. Instead, we're gonna focus on what's of interest from your perspective.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3091"&gt;&lt;h2&gt;00:08:51&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;So this whole question of "when my properties are set" is a pervasive theme. If we think about it, in some ways it's kind of a trick question. If I ask "when is this prperty going to get set?", well a lot of properties never get set at all and so the classic phrase here, thank you very much to members of the WPF team for suggesting, these properties are sought. If I have an inherited property, if I have a property in a style, these things never get set at all.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3092"&gt;&lt;h2&gt;00:09:17&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;And so look at the collection of methods that are available to me. SetValue() only gets called if I have a local value set, if I have a local binding, if I have an explicit local value. GetValue() is not really a parallel to that, it doesn't get the local value, what it gets is the effective value, where the effective value is the result of walking a chain of possibilities.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3093"&gt;&lt;h2&gt;00:09:38&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;It might be that my property is animated, in which case I get the current animated value. It might be that I have a local value set, if no animation is going on, that's what I'll get. If that's not present, we'll look at triggers in styles. They take precidence over other setters in styles. If they're not present, we'll look at the style. From there, if it's not present, we'll actually walk up and look potentially for inherited values for inherited properties.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3094"&gt;&lt;h2&gt;00:10:00&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;So it's possible that it comes from a wide range of places, and you should not count on SetValue() being called, because that's only the case for your local value being set.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3095"&gt;&lt;h2&gt;00:10:11&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;In the case of styles and animations, literally never happens at all.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3096"&gt;&lt;h2&gt;00:10:14&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;New feature in WPF 4, though, there are times when it would be really handy to temporarily change the value of a property without actually replacing its local value.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3097"&gt;&lt;h2&gt;00:10:25&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;Let's have a look at a specific case in this application where that would be incredibly handy.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3098"&gt;&lt;h2&gt;00:18:17&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;Thinking about inheritance, though, we talked about inheriting data contexts, and inheritance is one of those other topics where people get caught up a lot. Specifically, it's a question of what the logical tree is, what the visual tree is, and then what some people refer to as the inheritance tree. There really isn't an inheritance tree as we'll see just in a sec. The issue is that what inheritance comes from isn't strictly the logical tree, it isn't strictly the visual tree, it's kind of a hybrid of the two and in some cases it isn't related to either. So we'll walk through and think about that.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3099"&gt;&lt;h2&gt;00:18:52&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;Look at the example code that we have here, and what we have is a grid that contains a button that's templated. The button contains a text block. And so, the logical tree is the containment order. The grid contains a button, the button contains a text block. The template is set on a property of the button, it's not actually contained in the button, so it's not part of the logical tree. So the blue here really represents the logical tree.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3100"&gt;&lt;h2&gt;00:19:21&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;However, it's not that the template isn't involved at all in figuring out what's presented. In fact, it's very much involved. When we actually go ahead and run this code, during layout this template is going to get expanded. Our visual tree will actually have a few other elements in it, here. We get a content presenter inside a stack panel so that the text block can actually be properly presented on the button.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3101"&gt;&lt;h2&gt;00:19:45&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;What's interesting in this case is that we have now potential confusion about where my data context comes from. The stack panel has a data context that got inserted for me between the text block and the button. The grid also has a data context, so where does it come from? The answer is, the inheritance is designed to not suprise you.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3102"&gt;&lt;h2&gt;00:20:06&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;If somebody were to come along and create a new template, and inject a bunch of visuals and change the data context under you, it would surprise the author of the original XAML. This is a rare case where the template's actually embedded inline. Usually, you get it from somewhere else. It may be part of the system resource, what have you.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3103"&gt;&lt;h2&gt;00:20:23&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;So, what we do instead is when you're actually trying to inherit properties, first we will look for the logical parent, and we will track the logical parent in preference to anything else when looking for an inherited property.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3104"&gt;&lt;h2&gt;00:33:46&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;The ideal approach would be for me to actually learn about threading. And doing all the threading work yourself is kind of a pain. There's a lot of setup that you need to think about, there's a lot of communication back and forth between the threads, but BackgroundWorker does an awful lot of the work for you. And so for trivial cases, BackgroundWorker's a great way to go.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3105"&gt;&lt;h2&gt;00:34:11&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;What you wind up with is the UI thread where all of the sort of mainline WPF things go on. WPF has it's own render thread that you really don't need to worry about that tries to offload some of the raw rendering tasks to another thread for some parallelism. But BackgroundWorker creates a whole new set of threads so that if I'm doing a bunch of operations it will manage a pool of threads for me. It worries about how many threads are optimal for my hardware. I don't need to think about that at all. And what runs on those worker threads is my code. I get to define everything that runs there. WPF isn't involved, so I have free reign.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3106"&gt;&lt;h2&gt;00:34:52&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;It's great for these kind of long-running or blocking operations. But, you should think about this. DispatcherObjects and anyhthing else that's connected to WPF are sort of off-limits from your BackgroundWorker code. And what's a DispatcherObject? Well in WPF, everything is a DispatcherObject, right? You get into visuals, you get into FrameworkElements, you get into Brushes, you get into Freezables. Everything is a DispatcherObject, which means it's got tight affinity to a single thread, the UI thread in this case, and you can't use it anywhere else.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3107"&gt;&lt;h2&gt;00:48:54&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;Virtualization is a wonderful, wonderful technique. I highly recommend it. In practice there are a bunch of ways of dealing with this. The root question is "why am I bothering to create all of these visuals that aren't actually going to be displayed? why am I loading all of the images to create all of these thumbnails when they're not actually going to be used?"&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3108"&gt;&lt;h2&gt;00:49:14&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;Virtualiziation is basically a slight-of-hand mechanism, and if you've got a long scrolling list or you've got an enormous table that you want to scroll around, virtualization says I'm only going to create the things that I actually need to create the display that's on the screen at the time.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3109"&gt;&lt;h2&gt;00:49:29&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;Luckily, a lot of things do this automatically. ListBox virtualizes by default, so does DataGrid, which you may have been using from the toolbox in 3.5, but honestly is a WPF4 new feature.&lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=105&amp;amp;tid=3110"&gt;&lt;h2&gt;00:49:43&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;&lt;br /&gt;The way I deal with this is in my control, I need to make sure that anything that creates a bunch of items uses an appropriate panel. And so there's an ItemsPanelTemplate that allows me to define what panel is going to be used. I've just got a list in mine, so what could possibly have gone wrong? &lt;br /&gt;&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-3024972354304842298?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/3024972354304842298/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=3024972354304842298' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/3024972354304842298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/3024972354304842298'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2010/04/windows-presentation-foundation-4.html' title='Windows Presentation Foundation 4 Plumbing and Internals'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-142267181260395105</id><published>2010-04-14T13:12:00.000-07:00</published><updated>2010-04-14T13:13:17.537-07:00</updated><title type='text'>Multi-Touch on Microsoft Surface and Windows 7 for .NET Developers</title><content type='html'>&lt;span id="fullpost"&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=87"&gt;Multi-Touch on Microsoft Surface and Windows 7 for .NET Developers&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;span&gt;Multi-touch is going mainstream as part of Microsoft Surface and Windows 7. Come to this session to learn about how to create innovative new user experiences with touch – and how .NET developers can share code between both of these platforms. You’ll get a deep dive on the new touch capabilities in WPF 4 and the subset in Silverlight 3. You will also see how the unique capabilities of Microsoft Surface take multi-touch to a whole new level.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=87&amp;amp;iid=502"&gt;&lt;h2&gt;Multi-Touch Overview&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;An overview of multi-touch technology.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=87&amp;amp;iid=503"&gt;&lt;h2&gt;Surface&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;How Microsoft Surface and WPF interact.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=87&amp;amp;iid=504"&gt;&lt;h2&gt;WPF 4&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Touch capabilities in WPF 4.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=87&amp;amp;iid=505"&gt;&lt;h2&gt;Silverlight&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Multi-Touch on the web using Silverlight.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=87&amp;amp;iid=506"&gt;&lt;h2&gt;Multi-Touch Manipulations&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Multi-Touch manipulations and manipulation containers.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=87&amp;amp;iid=507"&gt;&lt;h2&gt;Inertia&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Inertia behaviors, manipulation events, and an intertia demo.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=87&amp;amp;iid=508"&gt;&lt;h2&gt;Touch Panning&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Touch panning demo and support.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=87&amp;amp;iid=509"&gt;&lt;h2&gt;WPF Extensions&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Surface's extensions of WPF&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=87&amp;amp;iid=511"&gt;&lt;h2&gt;Toolkit and SDK&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Surface toolkit for Windows Touch and surface SDK features for multi-touch.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=87&amp;amp;iid=512"&gt;&lt;h2&gt;Surface&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;More about the capabilities of Surface, beyond just multi-touch.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=87&amp;amp;iid=513"&gt;&lt;h2&gt;Roadmap&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Development roadmap for Windows Touch.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=87&amp;amp;iid=514"&gt;&lt;h2&gt;Wrap-up&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Resources, conclusion, and Q&amp;A&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-142267181260395105?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/142267181260395105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=142267181260395105' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/142267181260395105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/142267181260395105'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2010/04/multi-touch-on-microsoft-surface-and.html' title='Multi-Touch on Microsoft Surface and Windows 7 for .NET Developers'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-8794012426421855102</id><published>2010-04-14T13:11:00.001-07:00</published><updated>2010-04-14T13:11:25.126-07:00</updated><title type='text'>New Developer Tools in Windows Embedded Standard 2011</title><content type='html'>&lt;span id="fullpost"&gt;&lt;br /&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=85"&gt;New Developer Tools in Windows Embedded Standard 2011&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;span&gt;See how Windows Embedded Standard 2011 fuses the power and functionality of Windows 7 with the flexibility and workflow needed for the embedded developer to make devices come to life. Discover 2 distinct development experiences, Image Based Wizard v. Image Configuration Editor, and explore the workflow for creating an embedded device with Windows Embedded Standard 2011.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=85&amp;amp;iid=388"&gt;&lt;h2&gt;Windows Embedded Family&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;An introduction to the family of Windows Embedded products.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=85&amp;amp;iid=389"&gt;&lt;h2&gt;Toolkit&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Standard 2011 embedded developer toolkit.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=85&amp;amp;iid=390"&gt;&lt;h2&gt;Building Blocks&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Image building blocks.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=85&amp;amp;iid=391"&gt;&lt;h2&gt;Image Building&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;The image building process and a demo of the image builder wizard.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=85&amp;amp;iid=392"&gt;&lt;h2&gt;Configuration&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Image configuration and a demo of the image configuration editor.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=85&amp;amp;iid=393"&gt;&lt;h2&gt;Q&amp;A&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;A brief Q&amp;A session, and the wrap-up of the discussion&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-8794012426421855102?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/8794012426421855102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=8794012426421855102' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/8794012426421855102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/8794012426421855102'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2010/04/new-developer-tools-in-windows-embedded.html' title='New Developer Tools in Windows Embedded Standard 2011'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-5701075664235707590</id><published>2010-04-14T13:06:00.000-07:00</published><updated>2010-04-14T13:07:33.751-07:00</updated><title type='text'>Custom Behaviors for Advanced Microsoft Silverlight UI Effects</title><content type='html'>&lt;span id="fullpost"&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=83"&gt;Custom Behaviors for Advanced Microsoft Silverlight UI Effects&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;span&gt;Learn how to light up your Silverlight application by using behaviors to add physics-based animation and rich interactivity. Hear tips and tricks on how to create advanced behaviors, techniques to make them extensible, and how they can be integrated to create immersive applications and enhance interactive games.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=83&amp;amp;iid=912"&gt;&lt;h2&gt;Goals&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Goals and reasons for using custom behaviors.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=83&amp;amp;iid=913"&gt;&lt;h2&gt;Triggers, Actions, and Behaviors&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Triggers, actions, and behaviors. Demonstrations.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=83&amp;amp;iid=914"&gt;&lt;h2&gt;Easing&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Using easing functions.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=83&amp;amp;iid=915"&gt;&lt;h2&gt;Integration&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;View-ViewModel integration.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=83&amp;amp;iid=916"&gt;&lt;h2&gt;Visual State Manager&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;How to use the Visual State Manager.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=83&amp;amp;iid=917"&gt;&lt;h2&gt;Demonstrations&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Ripple click, explode click, and other features.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;a href="http://seattle.smartek21.net:48080/Sessions/Default.aspx?vid=83&amp;amp;iid=918"&gt;&lt;h2&gt;Wrap-up&lt;/h2&gt;&lt;/a&gt;&lt;br&gt;&lt;span&gt;Links to other resources, conclusions, and a brief Q&amp;A session.&lt;/span&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-5701075664235707590?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/5701075664235707590/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=5701075664235707590' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/5701075664235707590'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/5701075664235707590'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2010/04/custom-behaviors-for-advanced-microsoft.html' title='Custom Behaviors for Advanced Microsoft Silverlight UI Effects'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-1842826652704136559</id><published>2010-04-14T12:58:00.000-07:00</published><updated>2010-04-14T13:06:02.820-07:00</updated><title type='text'>Video sitemap</title><content type='html'>&lt;span id="fullpost"&gt;&lt;br /&gt;&lt;div id="panelVideoList"&gt;&lt;br /&gt;&lt;a href="http://seattle.smartek21.net:48080/Search/VideoDetailsPage.aspx?vid=83"&gt;Custom Behaviors for Advanced Microsoft Silverlight UI Effects&lt;/a&gt;&lt;br /&gt;Learn how to light up your Silverlight application by using behaviors to add physics-based animation and rich interactivity. Hear tips and tricks on how to create advanced behaviors, techniques to make them extensible, and how they can be integrated to create immersive applications and enhance interactive games.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://seattle.smartek21.net:48080/Search/VideoDetailsPage.aspx?vid=85"&gt;New Developer Tools in Windows Embedded Standard 2011&lt;/a&gt;&lt;br /&gt;See how Windows Embedded Standard 2011 fuses the power and functionality of Windows 7 with the flexibility and workflow needed for the embedded developer to make devices come to life. Discover 2 distinct development experiences, Image Based Wizard v. Image Configuration Editor, and explore the workflow for creating an embedded device with Windows Embedded Standard 2011.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://seattle.smartek21.net:48080/Search/VideoDetailsPage.aspx?vid=87"&gt;Multi-Touch on Microsoft Surface and Windows 7 for .NET Developers&lt;/a&gt;&lt;br /&gt;Multi-touch is going mainstream as part of Microsoft Surface and Windows 7. Come to this session to learn about how to create innovative new user experiences with touch – and how .NET developers can share code between both of these platforms. You’ll get a deep dive on the new touch capabilities in WPF 4 and the subset in Silverlight 3. You will also see how the unique capabilities of Microsoft Surface take multi-touch to a whole new level.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://seattle.smartek21.net:48080/Search/VideoDetailsPage.aspx?vid=88"&gt;Advanced Graphics Functionality Using DirectX&lt;/a&gt;&lt;br /&gt;The number of PC configurations is exploding. With the onset of netbooks as well as high-end desktop systems using the latest in graphics hardware, creating an application that can target all of these systems is getting harder every year. Join us as we explore the many options available in Windows 7 to facilitate graphics development across all different hardware configurations, from low-end integrated to top of the line discrete GPUs. Learn advanced performance and rendering techniques for Direct2D and DirectWrite, and the interoperability of Windows 7 technologies for making slick, high-quality graphics for your applications of the future.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://seattle.smartek21.net:48080/Search/VideoDetailsPage.aspx?vid=98"&gt;Windows Touch Deep Dive&lt;/a&gt;&lt;br /&gt;Windows provides applications a default experience for gestures and touch interaction. Applications that want to go beyond that basic experience have a powerful platform to build on top of. This session is targeted at developers interested in building touch-optimized experiences. We look closely at some of the more powerful portions of the Touch platform, like manipulation and inertia processors, as well as cover real-world problems that developers have encountered and overcome. Come help build the next generation of user experiences!&lt;br /&gt;&lt;br /&gt;&lt;a href="http://seattle.smartek21.net:48080/Search/VideoDetailsPage.aspx?vid=99"&gt;Developing with the Windows API Code Pack for .NET Framework&lt;/a&gt;&lt;br /&gt;The Windows API Code Pack for Microsoft .NET Framework provides a source code library that can be used to access some new Windows 7 features (and some existing features of older versions of Windows operating system) from managed code. These Windows features are not available to developers today in the .NET Framework. This session will show you how to access features like taskbar integration, jumplists, libraries, sensor platform, Direct2D, and more.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://seattle.smartek21.net:48080/Search/VideoDetailsPage.aspx?vid=100"&gt;Advanced Windows Presentation Foundation Application Performance Tuning and Analysis&lt;/a&gt;&lt;br /&gt;Come walk through the top performance and coding pitfalls in large-scale, complex Windows Presentation Foundation (WPF) applications. Learn to use the performance analysis tools and methodologies to find problems in real application scenarios, and discuss solutions to optimize your WPF application for maximum performance. Understand how to tackle a non-performing app and transform it into a quality application that runs as well as it looks.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://seattle.smartek21.net:48080/Search/VideoDetailsPage.aspx?vid=105"&gt;Windows Presentation Foundation 4 Plumbing and Internals&lt;/a&gt;&lt;br /&gt;Come get the inside scoop on how Windows Presentation Foundation (WPF) powers all its rich services – like layout, databinding, and animation. There is a lot of heavy lifting done for you under the hood; in this session, we crack open these system components, including the trees (visual, logical, and inheritance), the property system and its change notification, and a few of the routing systems that all messages go through. Bring your hard-hat for this one!&lt;br /&gt;&lt;br /&gt;&lt;a href="http://seattle.smartek21.net:48080/Search/VideoDetailsPage.aspx?vid=107"&gt;How Microsoft Visual Studio 2010 Was Built with WPF 4&lt;/a&gt;&lt;br /&gt;Get an insider’s look at how Microsoft created the next-generation, large-scale integrated development environment experience using Windows Presentation Foundation (WPF) 4. Learn best practices and hear real-world experiences in developing mixed Win32-WPF applications that combine WPF content with Win32 HWNDs. Discover how Visual Studio 2010 uses the new WPF text-rendering stack that utilizes DWrite.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://seattle.smartek21.net:48080/Search/VideoDetailsPage.aspx?vid=109"&gt;Embodiment: The Third Great Wave of Computing Applications&lt;/a&gt;&lt;br /&gt;Come hear about the next major wave of computing applications from Butler Lampson, a recognized leader in modern networking, and alumnus of Berkeley, Xerox PARC, and Digital’s Systems Research Center. Learn how computing applications evolved beginning with simulation, then communication, and how we're beginning to use computers for embodiment: nontrivial interactions with the physical world. Today there are sensor networks like the Inrix traffic information system, robots like the Roomba vacuum cleaner, and cameras that can pick out faces and even smiles. In a few years we will have cars that drive themselves, glasses that overlay the person you are looking at with their name and contact information, telepresence systems that make most business travel unnecessary, and other applications as yet unimagined. Hear about the new embodiment wave of computing applications from one of the leaders in the field. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-1842826652704136559?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/1842826652704136559/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=1842826652704136559' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/1842826652704136559'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/1842826652704136559'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2010/04/video-sitemap.html' title='Video sitemap'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-3073001683640647298</id><published>2008-08-31T19:59:00.027-07:00</published><updated>2008-08-31T19:59:35.685-07:00</updated><title type='text'>Video: Quick Tour of the Visual Studio 2008 Integrated Development Environment</title><content type='html'>Take a tour of the new features and changes to the IDE in Visual Studio 2008. See the updated web page editor, WPF form designer, CSS editor, and more. &lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_24&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Hi this is Chris tells in his video to take a look at some of the changes and additions to the Visual Studio 2008 ID  most the settings from Visual Studio five can be imported into a way and when you first install a weight if it s on the  same machine is so fine point he started out to be prompted as to whether or not you want to migrate euro five development settings  forward in this case have already installed only previously so we wouldn t get that prompt but there is a way to manually import settings  from all five let s take a look at it do that It sheer over 205 and we cooked tools menu select import and export  settings export and you can then select which of the settings you would like to import or rather export in this case is take the monster comics  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_24&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Selected then prompts us as to where we want to store the settings file which think that default safe with exported settings were  all set here in 05 foot back over 208 to a similar process but in this case will import tools import and export  settings import counts is whether we want to save the current settings that ideas will take that and here we have to select  which settings we want to import in this case we won a court that 05 settings file right here that we exported and  it will select that file next and then brings in all the settings you could alter those settings here meaning that we could  choose not to import some of the ones that we exported from all five Java that you just click finish and it will import all the settings  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_24&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Final thing to note here is that any third party add ins or code snippets will not be automatically migrated forward and you  will have to migrate to manually the community menu in TSO five here has been removed in the away diversion and surly options  have been migrated forward in two new options in a way he asked a question and check questions status are now in an  MSDN forums option and send feedback has been renamed to report about the other options in a community menu are no longer available  for switchover to await here and just take a look at where these options live now and so the community menu is known  here as I just mentioned and under help we have MSDN forms which is previously in a Senate question and check on a question and that these  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_24&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Feedback as this it is now report about several general IDE improvements here in 08 and to demonstrate a few these are done is created  based solution here with a single website and class library and open up several of the classes and pages here is also what does config  file now in previous versions when hit control tag you just been shown a list of the open windows so you can move them in  this one when I hit control temple we get is a nice summary window that shows us an early that names the active files but  the tool windows that we currently have open in a new CSI cycle through the files it gives us a little thumbnail on the right  side which shows us the contents of that window which makes a little easier for selection you can then honestly migrate nor move to that particular window you selected  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_24&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;You can also click on any one of the active tool windows to move to that another feature has do with docking tool windows and  dinosaurs below bit problematic for me is to wear a tool window might end up winning the docket let s take a toolbox here is  an example of the sort to float the toolbox can see we get indicators as to potential locations for docking and if we highlight or  over over over one of those indicators we get a high lace to highlight showing us where the window would end up his case within  this container this is the potential locations for size plus if it was tabbed to as another window here with a start page gets antitakeover  another tool windows associate the solution Explorer and we get the same sort of visual indicator that shows us potential locations for our toolbox window  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_24&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Their small but useful setting is up here under the tools menu  in the options and four fonts and colors we ve always been  able to set the settings for various things like text editor and  printer now there s a new choice environment font and what this  does is it covers the font for anything that you have not  set specifically here in this drop down list so if you don t see the specific  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_24&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Five for a Windows form application and once you ve created the project you can also go up to the project settings here  in the case of Visual Basic go to the advanced compile settings and down here you can see we can change it as  well from 23 or 3 5 and see sharp you ll find the settings under the build settings rather than the advanced compile  settings Windows presentation foundation applications are fully supported in Visual Studio a way we could add a new project type to see we  have both a WTF application as well as the VP of browser application templates and his case will create a debut PF application  can be is now editor a year with a split screen view on the top we get the graphical representation is now on the bottom of the tort  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_24&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Can think if we were to resize this window here you ll see the sample code in the editor below is  automatically changed we also have full IntelliSense in sample soap start tag or we get all the potential s MO elements  that we could adhere to think we would if we were typing ASP war visuals in Visual Studio or see sharp  or Visual Basic also have the ability to set what type of WTF application project you are creating here so Up  to the properties of the application under the application tab you see there s an application type which has the application  class library and console the application visual COAs has the Web application project type that was added in service pack one of Visual Studio  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_24&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;05 list to show you where that is in case you not familiar with it and add its new project not new website  and under the project template types there s an ASP net Web application project type and if we create one of those we  get a project structure very similar to we had in Visual Studio three and there is a couple of changes here to note  1 is this no longer requires FrontPage server extensions and it s also not limited to IIS you can use the local Web  server that was introduced in 05 when the things that happens here is that when you compile it would get here is a  single DLL representing the website so if you re migrating a website from both three appear to await you may find it whether  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_24&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Issues is a nice new editing feature for webpages the ID a cyclic default aspx here in our sample website at  the traditional source view and designed you to now there s also a spread to hear what shows us the graphic  on the bottom source on the top crew to take an element such as a checkbox here and put it in  to the diff in a graphical view will see that source you is updated in the reverse is also true let  s put a button near and harrowing owl and will see that a getting a message that the sources out of  sync with the design view switches click here and there we have both been sick another area the idea has some nice group  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_24&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Sees the management and editing of cascading style sheets at the pump sample webpage your default ASP act s party didn t split view and the  first tool window that s been added which want to show you is called managed styles that s up here on the format menu under CSS  styles managed styles in this particular style window provides us with a summary of all the styles that are available in the current page does in  this case shown are in a default CSS which is linked into the page as well as a local style definition in the page for this  new style want and notice as I hover over any one of the styles that shows me in the tool tip window to complete definition of  the style in addition there is a circle around some these elements in that indicates that those particular rules are used in the current page you can edit any of the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_24&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;A styles directly by either double clicking on it and it goes right to style definition and we can alter something here that s put this  in as font weight will make bold care since we synchronize the graphical view may get our change back over here in new style in the  tool to Windows you are late pope is there as now as well the other addition is a CSS properties window which is appear under the  view menu CSS properties for this shows us is the current applied rules for the key for the active element in this case they haven t  selected any element in the designer so the body element is being selected and shown as showing us the rules are applying to that compass like  to go to mistake the second line item element here see that that is added to the applied rules and also noticed down here in the sea is  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_24&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;At properties window that this rehab repeating properties in this case font family and font size in the first instance has a red line  through it and what that means is that it s showing us we are overriding an instance of that particular property safe font size  was medium higher up the inheritance tree and we have now overridden it with 20 pixels you can edit these values are right here  so let s take this down that s to 15 pixels and we get that change automatically reflected in the design mode he over  here on the right now are currently in the summary mode in the cascading style sheet properties window here so if we turn off  to some remote and then we see not just the properties or that are currently applied for use in this case font family font size etc  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_24&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Who see the complete list of CSS properties and we can change any of these here  as we did with the font size will have the ability like the regular property windows  that you use to to sort of the way to have an alphabetical sort of all  the CSS properties files on an off night auctioneer that she says she ll set properties  on top saloon at the scroll through the list on a FindWhat properties have been said  and what have not been sent even though they are bold as compared to normal text  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_24&amp;&amp;bookmarkIndex=84"&gt;Minute 14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;On various areas  such as the  ID but many  other areas as  as Chris Pelz  thanks for you time  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/3.5-videos/video-228.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-3073001683640647298?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/3073001683640647298/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=3073001683640647298' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/3073001683640647298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/3073001683640647298'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-quick-tour-of-visual-studio-2008.html' title='Video: Quick Tour of the Visual Studio 2008 Integrated Development Environment'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-6401937295032324226</id><published>2008-08-31T19:59:00.025-07:00</published><updated>2008-08-31T19:59:34.367-07:00</updated><title type='text'>Video: IntelliSense for Jscript and ASP.NET AJAX</title><content type='html'>This video provides an overview of the new Intellisense features for JavaScript in Visual Studio 2008 including core JavaScript methods, external .js files in .aspx pages, between external .js files, with core Microsoft libraries like MicrosoftAjax.js, client JavaScript behaviors, controls, and libraries, and web services. In addition, the integration of the new XML comments for JavaScript with Intellisense is demonstrated. &lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;I have this dispels this video would it take a look at some of the exciting new JavaScript  IntelliSense features in Visual Studio 2008 right get started let s create a new website project here and  we ll just call this website TV and we already have a default is Jack Celeste at a  JavaScript file here as well and will just call this JavaScript file it kills and everyone in a  reference to that JavaScript file over here in our page splits do that whole at a script for  the language is equal to JavaScript to type a sequel to tax JavaScript and the source is equal to or are you  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Kills JS file now let s take a look at a the JavaScript IntelliSense features a person  he wanted to do is give this to the element and ID and let s call this  page content and then I went ahead a script block inside the page your slips to that  language equals JavaScript can type text JavaScript and will create a little function near notice for getting  IntelliSense for creating our JavaScript function clueless startup and then we ll define a couple local variables  here notice for getting IntelliSense again for creation of our variable in the first one will call  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;His container and this comes from the document element in the dead element by ID is pretty nice  for getting the IntelliSense help us create this page content and endlessly another local variable coal Index that  has a value of zero and let s just create another one called this is some text which  is has some text in it now only go to reference these variables in code what we ll  see is the second future of JavaScript IntelliSense which is type inference could take the container local variable  that we have here we go to one of the methods noticed that the IntelliSense engine has inferred that this is a guy  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;On document element and is giving us the appropriate properties and methods that go with the dawn element likewise if we were  to use the index variable that we created here we re getting a variety of properties and methods that pertain to a  numeric valuable and likewise if we used the text variable we re getting a bunch of methods and properties that pertain to  text now you can go even a little bit further than this and let s say we take our index variable and  since we re not strongly typed here in jobs that we can do this and we changed that to be some text  down here and then we do to use that week at the textbased IntelliSense thread says penny though what it would have been  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;If we were to use index up here before we assigned a text to it  and it is a quite an intelligent engineer so to speak because here is giving  us the numeric methods and properties now let s go and add a method over  in our utensils JS file here so I notice this is HS finally getting its  same intelligence that we had over and default SPX to define our function and get  a username and let s have this take a variable called ID and a pillow sample method here that would  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And more complicated than that for this demonstration okay now let s flip back over to our default aspx page and go down here and let  s say we want to create a local variable called name and we want to call that method over the JS file to automatically get IntelliSense  on the methods and are JS file without having to do anything special including primer information that we need to pass to the method that recall  so it s pretty neat if they want to take a look at the new XML comment capability has been added for JavaScript lets the back  over here too are JS file that you probably use the XML commenting capability in the seashore or knowing in Visual Basic and there s a  similar feature that s been at it for JavaScript has a few differences but it works pretty much in the same way for example we can add XML  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;These comments to our code here that ll be picked up by the IntelliSense engine facility can show them to us when we re  using the method over in the SPX based on the sure how that works and one difference here is that the comments are pleased  immediately inside of the function rather than above the function name which is what she would do in Visual Basic or seashore and the  reason for this is that there is a two string method in JavaScript that allows the JavaScript engine here behind the scenes to pick  up the contents of the method and then parse the XML comments so that we do it is at a triple comment counter the  same issue would in seashore and then he used the similar XML elements for example we can type in a summary element here is  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;This insane method to did the person s name from an ID value close  that off and we can add one for the parameter in the name of  the parameter is ID and this is the person is ID value and we  can also the head one for the return value and this is the persons  name and we do need to save the JS file here before we get  back over to default the SPX of the parser to pick up the information about  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Over to default the SPX and must create a nether variable here will name to it let s you see get username and notice  what getting the help here in the tool tip this is a method coming from Nice summary element that we at it and likewise  here when we go to type deeply ID parameter were getting the information provided in the prime element that we can take this even  one step further to show you some additional capabilities and smell comment documentation for tobacco or the JS file here all we can do  is we can go over to the prime definition here and we came at a type attribute this case will make this a number  and were also can indicate that the signature because JavaScript doesn t only has a number type it doesn t have an integer type takedown is yet another attribute  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Which use integer equal to save this link now go back over to our default is the eczema said third local variable  here to username with her IntelliSense and noted notice this time in addition to just the ideas the name of the parameter  would getting an indicator that showing us that this is a number so will make this 150 fifth number of other attributes  that you can edit your XML based comments to get rich IntelliSense and his nice blog posts here let me flip over  to that by urchin LeRoy and a leave this will address up on the screen here for just a moment so you  can copy it down and go look at it in a few view the video so he seem IntelliSense from an external JavaScript file TCAS  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Ex page what about from one JavaScript file to another place for a  second JavaScript file here in our website and this one lets call cordite  JS and let s said a function in a year to call this  function get flat law and will take him down and address and the  let s return in this case which is an arbitrary number for your  lead said some JavaScript comments to win a summary tag here for an address ago and  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;At a parameter in the name of it will be address type the full  string this is the address to find the LAT law and Leslie will lead  a return to say the LAT law of the address okay will save these  changes to core JS here now let s go back over to our utensils  JavaScript file but we need to do in order to have the Cross JavaScript  IntelliSense screwup here beginning of the file symbol paste in a reference element to the cordite JS file so  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Say that here as well now let s go down here and at a nether function to eat  those who called us get a user LAT law have an inbound address to this and now we  take GE wheat had the get LAT long method from the court got JS file so take that  had noticed week getting the IntelliSense for the address parameter as well and it will pass in this  address value here in a little close off the method and actually will do here is returned that  like that so this demonstrates how we re getting IntelliSense from one JavaScript file to the other I guess just  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Closed loop here when you go back over your core JS and the man at a reference element  appear to pass equal to the pills diet JS and you ll save all our files you have  root go down into this lat long function and use get to see we have our big username  and get user Lab law form are you pills JS so this is shown us that we can  get the Cross JavaScript IntelliSense what about referencing standard files like the Microsoft Ajax library while we can  do that here as well and it s just a slight variation on the reference element that we use for you JS sweat  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=84"&gt;Minute 14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Other reference element and here instead of adding a path attribute we re going to add a name attribute and  the name attribute is used for any JavaScript files that are dynamically added by this script manager in this case  the Microsoft Ajax library suicide that name in gross soft hate Ajax JS close that off and say things here  now if you go down here into our get let long function in the city wanted to use one of  the methods the mics of Ajax library for example let s use the get shortcut here we have IntelliSense for  the Microsoft Ajax library with all the corresponding methods that we have in there as well as you can see we re getting a parameter  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=90"&gt;Minute 15&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And type information in here as well tailored to screen appears to concede that he made the standard use of the  XML based comments for documentation and IntelliSense in your JavaScript files that are be very useful for your development teams in  terms of sharing libraries and having access to this information that they did within a Visual Basic or see sharp methods  as well in excess look at some features and IntelliSense related calling Web services from JavaScript reference to want to do  is edit Web service to our website here so what add a new item at a Web service and will call  this test Web service law at it and then as the standard hello world that s just changed it slightly here get message and will  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=96"&gt;Minute 16&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Take an inbound argument as a string and will do is just concatenate this with a low Arielle and  then the other thing we need to do is to add an attribute to indicate this is a script  based service lets go up here and let s add a system Web script services script service attribute their  wish y all said here we re now with our Web service say that let s switch back over  to our default ASP asked page in the first we want to do is go down here in the  form and we want to a script vendor to go IDE screw manager and a run in the goals  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=102"&gt;Minute 17&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;D rer here we go and we know what AAA is the service reference  to the Web service which we just created and so add the services element  and then within that web based service reference element in this case the path  to our Web service is tested Web service slammer should be all set with  that now if we go back up here to our script block at the  top of the default ASP XP page and in this case we want to call a  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=108"&gt;Minute 18&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And including all of the parameter information that we had it to do so will say Chris so that s  an example of how you can get IntelliSense for Web services in your JavaScript which also should be a very  useful tool Visual Studio OA has added some nice features related to a client libraries or behaviors for Microsoft Ajax  extensions like you look it two aspects that one is the new templates for creating the items and the second  is the nice integration with JavaScript IntelliSense close look at your website and add a new item noticed that there  is a new templates for Ajax client behavior client control and client library in this case let s just create a client behavior JS file  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=114"&gt;Minute 19&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Templates filled out a number of the major items that we need for treating our behavior including venturing the namespace as  the default namespace the website up your website VB and it s also added a preference for IntelliSense for Microsoft Ajax  library that we saw a few minutes ago let s save this client behavior JS here and now let s go  over to our core JS file went in at another reference of Peter and this one when you specify the path  to the client behavior JS file now we don t hear into our yet let long method if we take the  view be gay IntelliSense for website VB the client behavior and then all of the methods that relate to the behavior sets an example of how  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_23&amp;&amp;bookmarkIndex=120"&gt;Minute 20&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;He had integrated behavior and an associate IntelliSense into our JavaScript file here court at JS and it would  apply to creating a client library or a client control as well since a look at the new IntelliSense  features for JavaScript and Visual Studio 2008 I know I m really excited to start using this because with  the increased presence of Ajax functionality and websites and the corresponding increase in JavaScript these features will really be  good for productivity encourage you to download the sample code take a look at it to your leisure this  is Chris Bell s thank you for watching the video on IntelliSense features in JavaScript and Visual Studio 2008  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/3.5-videos/video-227.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-6401937295032324226?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/6401937295032324226/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=6401937295032324226' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/6401937295032324226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/6401937295032324226'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-intellisense-for-jscript-and.html' title='Video: IntelliSense for Jscript and ASP.NET AJAX'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-1762468519707409093</id><published>2008-08-31T19:59:00.023-07:00</published><updated>2008-08-31T19:59:33.262-07:00</updated><title type='text'>Video: How Do I: Use the ObjectDataSource with a Data Access Class and Business Object</title><content type='html'>In this video Chris Pels will show how to use the ObjectDataSource as the intermediate layer between data bound user interface elements and a custom data access class for a business object. Uses of the ObjectDataSource in the GUI Design mode and declaratively in the source view of an .aspx page are discussed. In addition, the considerations for design of the data access class and business object for use with the ObjectDataSource are covered.&lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Will rule just those this will views this as objects with the object data source in ASP net with this survey committee  website and in this website will we going to do is who can I have a business object which we can call  customer and within a bind that customer object to the object data source in an ASP net webpage solicit up the default  aspx page a bit before you get into the business object side of things when they do is place a couple controls  on this webpage and it lets see the first one we re going to put on here is a review that could  be the object would you use to display the data in that we also need an object data source will put that  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Data on the form and we ll come back to configuring the object data source in the grid in a few minutes slowly  want to do is have the data in this grid be bound to a set of custom business objects that we create subordinate  to overhear the website and you could do this in a separate assembly for what they would hear the website just for demonstration  sake is class which will can call customer and business can be our business object which contains our customer data and then we  can create a companion class which will can call customer data so let s set a class customer data and this is to  be the class that controls the data access to and from our customer objects so through our customer class and flesh that out first select the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Several properties in year of its greater private variable for the company name and  it will make that a string and will create a corresponding property and that  also a lot of sleepy type string and then will return from that the  private rival contents and likewise will set a sense for a company and let  s just put a couple more in here is the one for the city  and it will creep across my property set to get and set it will  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Turn_city and will set_city equal to the inbound value and thus create one  less one wall call state and will create the property as a string  in it that we have returned_state and full set_state so this is going  to be our business object that stores our customer information we also need  to put a constructor insider class so to emigrate to different constructors so  let s create a public s of new and will choose to leave  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;As it is no part in dump routers to that constructor illustrate a second constructor and into this blood work  and no allow a the inbound constructor to have parameters to set the different values in our company object so  we ll see but as string and then we ll say the city to live for city string and will  say us via a substring and out before our state and then named out in his constructor will disable me  got company equals sealant bleeding down parameter value meet at sea will see T Y and me State 60 and  LOL is the ease of the instantiate an instance of the customer object and set the different values of the properties  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;It don t have to have this secondary constructor as I ve been here to set the about properties  is just a convenience factor to see when we do the data access by that just makes it a  little easier to create instances of our business object now let s go back over to customer data with  you as I said is our customer data access class first thing I want to do here is Ed  to import statements just make does have a little as typing and the first one is system data and  the second one is component model and you ll see how we can use that component model namespace in just a moment  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;This 80 shared class words should as they were to make the methods have shared inside  this class classmate methods for major operations as a person who can make one for inserting  tools a public shared insert arts are a set of insert customer and in down to  the insert customer method work in a pass an instance of our customer class so we  ll call that customer as type customer then let s do one for updating a customer  at the very similar call this update customer and it ll pass the customer object and  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Let s make one for deleting a customer and shared as well so will it delete  customer end in this one are old past day and a customer ID as an integer  and then we need a method that will essentially select our customers and let s be  bad shared as well this would be a function because we re going to return our  customers data and will call this get customers in over there that do here is return  a data table now there is several ways you can approach making this get customers method well  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;One would be to return a data table so essentially what walked the database like the data and return it back as a data table you  could potentially return it as a data set that clinic gets away from our custom business object approach and another thing that we can do instead  of the data table is we could return a generic collection of customer objects and Israeli law to the basic operation of the object data source  in relation to these custom does this object that there is a variety of ways that you could approach this in what you have to do  is think about your own situation and determine which of those approaches might be the most efficient for you but the reason on a return a  data table is that that s a very quick and efficient operation the alternative returning a generic collection of customer objects would mean that I have to instantiate an instance of  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Customer object for sound every customer that I retrieve and then put them into the collection so there is a lot more overhead associated with that  and there may be a reason that you want that collection of customer objects because it gives you instant instant access to the customer data in  a customer object format but in this particular approach were saying okay we re just in a return a data table because they get customers method  is purely for selecting data and displaying it on the screen and we re getting a little squiggly line on 21 because we aren t returning  a data table so for the moment let s just return a new data table and that will suffice them to come back and fill the  Senate in a moment when I start to show you the relationship between this customer data class and the object data source in effect before we start  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Rested with the adapter data source when they put their second get customers method in here so you would  see how that might work separatists to another public shared method click as customers however bold when you return  from here would be a system collections generic I collection because the work for the object data source it  does need to be a type are strongly typed collection and the type of question that we were to  return is of type customer objects so what we do here is returned and this is just as this  account of a stub at the moment and we go to system collections generic and let s just return a list of type cost  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Are in me just comment out this second get customers method because such a suit in the squiggly line on 19 because this has the same  signature as to get customers will comment that out now let s go back over to the webpage and take a look at the object data  source for the first time to start see the relationship between the object data source and our customer data class swiftly to the smart tag for  the object is worth and select configure data source and Thursday were prompted with is choosing a business object and if we look at the list  you see there is several business objects listed here the customer and customer data is also this check box on the right to show all the  data components and we ll come back and look at that it promoted in just a few minutes have been assured a bit about the connection between this check  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Ox and how you code your business object data access class soared up a customer data because they know that s where our data access methods  are located and will click next and now you can see where prompted to define what methods in our business object relate to selecting updating inserted  and deleting our data and if we go down to the slums like to absolve it out to choose a method and you ll see that  we have kicked customers and that s the only one that s being displayed because it s the only one that s a function that returns  a set of data that might logically be used for the select statements of the some intelligence here to this wizard in determining what methods are  business class or appropriate to did pick that and when we picked the dead customer he can see that it s now scientists are select method and  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;To do now is go back to the data access class or put a little bit more information in there and will return to this wizard  and completed on just a click cancel it alone because I don t want out some of the food to get generated in the source view  afar paid just quite yet so click tickets he clicked cancel and I can see that the relationship to the object data source and a data  access class to know in a classless look at how we can make the data access class more intelligent or I should say puts him at  use the data access class that made the new wizard look at the data access class in a more intelligent manner so will want to do  is put some attributes here in our data access class and the first armored output is the key to object attribute as you can see it has two methods are gestures  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=84"&gt;Minute 14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;To inbound parameters that relate to whether or not  it s suitable for binding it with an object  is source and where artists a true because it  is and what this attribute does defines our customer  data class as being a bindable class with the  object data source and the mages compile our class  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=90"&gt;Minute 15&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Be customer data class because it is marked with that data object attribute soon also back over to her data access class and  we can put some similar attributes that are for the methods in the class so lets down and make this a data object  method and then you can see there are some the new values to indicate what type of method if this and this is  an insert method and then there is an a second signature for this and it s what whether or not this is the  default insert method and will say is true that and now we re going to go down and I will put some attributes  on the additional methods so say this is also a data access or a data object method and this is an update method and yes it is the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=96"&gt;Minute 16&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Default walk the same thing for delete data object method of type delete  the default and get customers in this one is of type select and  it is also the fault insurgency here if we had multiple methods that  selected data we might mark the primary one would be to attribute as  we ve done here forget customers and the other was my also be  marked as a select data object methods button may not be the default method flex compiler class  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=102"&gt;Minute 17&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And then there we are little back over to default is the next configure our object data source and will uncheck this just so  we can see everything there is both are we ll pick methods or classes will pay customer data for the next his finger right  what it s done now is it s automatically picked our get customers method because it knows that is our default to select method  and lets forward to the update path it has also selected the update customer method by default because we have the attribute on it  let s just do the two of those at the moment click finish and let s go back into the source to which we  haven t seen yet and take a look at some of the things that are inherently just reformat things a little bit so we can see it better  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=108"&gt;Minute 18&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;On the screen and you really have a couple or ad views here the hand limit is Rudy ordered these a little bit cousin  and read a little more logically so what we have as attributes object data source are what is the type name that is the  object for our as our data source in this case is our customer data class and then what is the type of object that  is used within this data access class for insert update and that is the customer object and that we have the corresponding names of  our different lead insert select an update methods and then you can also see in our we have some delete primer is here because  for members of the delete method takes an age term containing the customer ID so we re able to specify what primary is in this  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=114"&gt;Minute 19&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;These four are not delete method we also could have separate parameters defined for save the insert method because in that case we might  not be passing the customer object we might be passing individual values of like customer named city and state so we can define those  insert parameters to be different than the default data object type which is customer source work with a select method first look back over  customer data in a air we have in our select method is right here and we have a little stuff in there at the  moment which is just returning a new data tables and would not return any data and what I ve done here is create a  custom code to create a data cable and out of the sky taken from the toolbox and drag and drop it in here week  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=120"&gt;Minute 20&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;As this will save us from behind in that it would take a while for me to type all this while you  watch is what this does is it simulates going to the database and getting some data about our customers to his critics  are three columns companies city and state and returns them and after putting some data into those column so let s go  back over to our default aspx and just do a couple things here and I m just in a set the auto  generate columns property of our grid to true and then are data source IP is going to be equal to the object  data source one is a copy and paste that somebody make sure we get that name correctly and we could do the same thing  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=126"&gt;Minute 21&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Up in the design view we could select the object data source one of just doing it down here in the source so you can see that  there s both approaches now if we go into the design view let s fire up our website and see what happens so before we do that  let s just go over into customer data and market customer that the disparate breakpoint here at line 26 and we can see that we do hit  this method to retrieve our data for our data source to look back over to default aspx and it s fired up in debug mode s first  time we started up sources can add debug most of the web config and page starts slowed and here we are in the method get customers getting  our data is just to get out in three decades table populated and will hit F5 to let it run from here and here we have our data coming up in  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=132"&gt;Minute 22&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;It really sickens me that is bound for data table from that s coming from our business object smells come back and just take  a slightly different approach and one can I do this time is broken up flush out the code here in our data access class  for this alternative way of getting that customers as a collection of customer objects and we ll see if we can mind back to  work great as well slipped on comment or other method here and we ll just can you give this a different signature organ call  this by object is to get customers by object and rather than just return this job like it did with the data table approach  I have some code over here that I d made up ahead of time and there it is focused copy that it is pathetic  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=138"&gt;Minute 23&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And tormented and this is simulating it as if we went to the database got the data for our customers and then create  a new instance of the customer object and edited to this generic collection of customers which I have called customers in this case  to cyclical customers the local rival for the data table off about 60 over using a constructor that is set up were passing  in the company name city and state when we re creating each new instance of the customer object and we want to put  a data object method attribute on this one as well and it will go down and create that can and will say this  is of type select but this one were to say false this is not hard to fault the select method for the customers  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=144"&gt;Minute 24&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Is now role as head is not limited to break the year line 4694 to default the SPX and the school I could do this here  in the code but I want to go into the design view to show you something that happens to so you re aware of it Salieri  are we need to change the method that s been used for selecting our customers less going to configure data source for the object is worth  going to keep the customer data class as a business object and you can see we have the I get customers method and what we want  is the get customers by object and you can now see that is available in our drop down it knows its select savings and only take  that and let s click finish and see what happens is the grid refresh to intelligently know what properties are of our customer object and let s go back  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=150"&gt;Minute 25&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Into the source you because here we can change it to get customers by object and that s all that changed here now let  s fire this up and slowly get all fired up in a debug mode and as the page loads you can see who we  are and are committed school lucky we are not get customers by object method just can create instances of the customer as well let  it go from there and here they are on the page just like we had from the data table there is one slight change  here and that is the order of the fields is toward the columns I should say is slightly different and that s just reflecting  what s in our customer object so what we could do is go back here in Tuesday to fault a SPX page and or auto generating a  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=156"&gt;Minute 26&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Columns we could say false here and we could specifically set up bound columns in fact let s do  that sells a false go in here and will say columns and then within columns we want as a  downfield syllables a data field equal to a company in the header text is also equaled company and it  is put another one in a data field equal city header text is also city and in fact let  s just leave it at that let s just leave to columns even though we know that the state  is there it well as well and see if we get that s let s fire up there we are in our method and  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=162"&gt;Minute 27&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Will continue on president five and up comes Art grid which this company and city so that shows you not only binding to the customer  object but it also shows you that we can define the data fields which in essence are the properties of our customer object you re  probably familiar with doing this when you have said it is said or did a table where you specify the column names but in this  case were actually specifying the data field is a property of our customer object so looked at selecting let s look at how we might  do us an insert update or delete to do that we disagree to start editing tool lets go into the grid edit columns going to  add a command field for edit update cancel him to be the first column in our grid by default the show edit button is equal to true will just leave  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=168"&gt;Minute 28&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;To get an edit button in our grid and now when we had it and decrease goes to update it because it s  bound to object data source age should call the update customer method in our customer data class lets go over there set a  breakpoint in the update method right here and well we would typically do here in our update customer method is performed the operation  such as calling a stored procedure in our database passing inbound parameters to that store procedure obtained from the instance of the customer  object to actually update our customer data and we also might refresh the grid back on that page in the code behind default  ASP ask to look good to go let s just doublecheck okay let s start up the debug mode here we get our Griffith  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=174"&gt;Minute 29&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Said it say IBM will change the name to test that the update link can see here we are in balance to what the  update method in our customer data class hears the instance of the customer object lets expand them down and you can see that the  company name coming inbound inside of our customer object it is indeed test which reflects the change we made in the grid so we  went on to update the data in the database refresh the grid then we would have that change to our customer data and would  follow very similar approach to say the leading or inserting a customer data we hook up the user appropriate user interface element whether it  s the created details view wore a custom made forum with text boxes etc we hook that up so that the appropriate method either insert for nuke  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=180"&gt;Minute 30&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;For delete for an existing customer was called in down we get the customer object and then we would make the  appropriate changes in the database and is one part of this versus lobbyists shut down the webpage one of the back  over to the default ASP next page in the source view and point out that I mentioned early on that you  can have parameters in this case for the delete parameters we could also change things like this picket at select primer  is here that passed in our justice like we did at insert parameters here that passed in the company name city  and state as separate parameters say they re coming from eight series of text boxes we could mind to those appropriately passed in the individual values  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=186"&gt;Minute 31&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;To our insert customer method in a data access class and use those alternatively we could leave it as a customer object construct an instance  of the customer object in the code behind on far page and passed that customer object in down to our insert customer method and it  is this more accustomed to insert a different parameters to methods you would want to look at the events associated with the object is source  specifically look at the inserting updating and deleting an offense and those events give you an opportunity to manipulate the parameters going in down to  the corresponding methods in your object data source source can see this a number of ways that you can approach using the object is source  we ve covered a few of them here but it should give you a good perspective on how the basic functionality works as well as the flight  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_22&amp;&amp;bookmarkIndex=192"&gt;Minute 32&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Ability and using the object data source in different ways and then you can figure out in  your own situation what the appropriate approach might be for your particular application to occur to download  the sample source code that comes with the video is available in both see sharp and Visual  Basic then you can use that as a starting point for figuring out the best approach to  using the flexibility of the object is forcing your particular application is as crisp else thanks for  watch this video on using the object data source with the custom business objects in ASP net or wall  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/videos/video-267.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-1762468519707409093?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/1762468519707409093/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=1762468519707409093' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/1762468519707409093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/1762468519707409093'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-how-do-i-use-objectdatasource.html' title='Video: How Do I: Use the ObjectDataSource with a Data Access Class and Business Object'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-4234107246683142846</id><published>2008-08-31T19:59:00.021-07:00</published><updated>2008-08-31T19:59:32.090-07:00</updated><title type='text'>Video: How Do I: Work with Master Pages Declaratively and Programmatically in ASP.NET</title><content type='html'>In this video Chris Pels will show several aspects of defining and using master pages in an ASP.NET web site. First, see how to create master pages declaratively using the ASP.NET master page model and learn what information is best suited to a master page compared to an individual content page. Next, see how to programmatically assign master pages on-the-fly in an individual content page. Also learn how to create a base page class which assigns a master page programmatically for all pages that inherit from the base class. In addition, see how to set the master page in the web.config file. Lastly, see how to access elements in a master page from an individual content page including some best practices for structuring access to master page elements. &lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Of whole skills so you will learn how to work with Master pages in ASP net website lets get started by  creating a simple website now many of you are probably familiar with the concept of the Master page because it s  something that I m sure many of us who developed websites have encountered from one time twin other until Visual Studio  2005 to really wasn t a systematic way to approach this in ASP net or at least he had to roll  your own when created what so just went to assess to what the concept of a master page is and how  we can use it let s go over to the ASP net website and look at the layout of this page and many  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Any times you have a website similar to this where you have the header area at the top where you have your navigation in a various types  of content inside the page and every time you move to a different section of the website you would want the header area with navigation to remain  constant you might also have a footer area down the bottom such as we see here and you would also want that to be constant from one  page of the website to the next no prior to the Master pages in ASP net who had to figure out a way to do this either  on your own where you would have created what is essentially a Master page Roche would have to include the header and footer HTML content in every  webpage that you created that becomes problematic because obviously then that s like repetitive code in that every time you want to make a change at the code each  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Individual pages and make that change so Master pages and addresses this issue Back to ASP net and Master pages are essentially nested HTML  pages and by that I mean you create a Master page and then every time you create an individual page you refer to the  Master page and say yes I want my individual page to be based on the master page and then in essence your individual page  is nested inside of the Master page and that gives you a consistent look to all your pages in that they all have whatever  content you put on a Master page where to start by creating what s called a Master page file for our website like what  the website and add a new item and notice here the list templates is one called Master page that sought to use for treating the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Shoes and Murdoch called this default master adds it to the website and noticed that it has a dive master extension  and the reason I call the default master that s by no means requirement have been named master within the page  name but that helps me avoid conflicts with pages called just default a call to fault master does the little nuance  that I ve learned over the time of using Master pages took a semester page here looks very similar to a  traditional default ASP X page with a few differences there is an added master directive rather than an act page directive  and then there s a server side control called content placeholder and content placeholder essentially represents the location in the Master page where any content  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;From the individual ASP X page is placed in what I can do is create an individual page here and not that  utilizes this default master page and doubt become a little more clear and never to come back and fleshed out the layout  of this master page splits can create a new webpage and I m a call this webpage of furniture with Sabre creating  a online store type website and would have pages represent the different categories of things we sell and want to go to  create this page to notice is a checkbox select master page will check that here s a list of our Master pages  in the website kernel really have one default masterful take that notice this furniture page looks pretty different than the regular default ASP  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Page there s a lot more elements here in the default ASP experts in our furniture all we have is what  s called a content element or control that represents a link back to the content placeholder on the master page notice  here we have an attribute called content placeholder IDE and that s content placeholder one back to the Master page received  that is the relationship to this content placeholder here on the master page and then hearing content one whatever we put  inside of this is essentially any regular HTML or ASP net server control that would put on a typical ASP page  so let s just put our furniture here has any these attacks that allow us to see that we are indeed on this page  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And now let s go back overtly to say that we ll go back over to the master page no master page by default  here just has this content placeholder so it really doesn t look anything like our ASP net page of a cell with a header  and footer so let s go ahead and put some additional elements here in the master page and add another dude here which we  can call header and a medical one down here below the content area and will put the text footer in there for the moment  Elijah said a little bit of in line style here so this will or wouldn t do here is routed to say how a  height of 40 pixels and will save background and it will make this a yellow De Soto stand out a little bit only look at it and on the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Be that style mountaineer put it in the footer gave and what we ll do down here is will just put blue is the  color so now was starting to have a Master page looks a little bit like ASP net and the censors got a header followed  by a content area and the footer on the bottom else back to our furniture paid for a moment and we still only have  the text furniture here but let s go into the design mode on our furniture page and now organizing for the first time is  the impact of using a Master page Sybil was here visually is the merged of the individual furniture page with the Master page at  the header area to top the footer area at the bottom and then here in the middle is our content area and noticed that it  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Is an area where we have the design surface just like we would have the full page design service in a regular  default aspx page that does not tied to a Master page however we can only so called idiot or a content in  our furniture page within the content area are essentially that s representing what s inside the content control so if I were  to take something like a button and drag and drop it onto the design surface of the furniture page and we go  back to the source It that button is being edited here inside of the content server tag in our furniture page on  it as a line break in their now what makes this furniture page tied to the master page is the master page file attribute up  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;During the page directive and notice that Paul points to the default master page and we created up in the root of the  website so essentially when you tie in the GUI designer when he reentered the new item added a web form and selected the  Master page although that s doing is putting this master page directive and then including an ASP content control by default so we  can do that manually as just as easily summer take this master page attribute that we have here when a gorgeous default SPX  and I m in a paste that into default SPX and what we need now is to remove some of this extra HTML  element is afterward were getting an era here already so that world to his scientists cannot take all this HTML and get rid of it  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And go back over to the furniture page and I m going to take a content control would have put it in here  and then we ll just close set out to now are default page is identical to her furniture in that it s using  our default master page with the design mode here on the default and you can use it with a safe welcome to the  shopping site and that s being added here inside of our content tag on the default page so seen how do creed or  associated in any individual page with a master paid using a GUI wizard declaratively here with a Master page file attribute you can  also do it programmatically lets go do that you can add another page to the site web form and Islam Burkett were going to call household  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;For household goods and I m not going to select a Master page went  back to our site and we want to end up with is a has  a large as they tied to a Master page plummeted do is just get  rid of all the HTML inside the page and believed leave the page directive  and now we want to go over into the code behind here the code  behind page what we can do is programmatically assign a Master page so it went as a defense  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;I ll add you that we saw in the declarative syntax of the SPX page so many to do it is here we would  just put the default master master and that will attach that master page to the individual household page slots go back over the SPX  and to put some content in there and women do is copy will we had in the furniture page and put a content tag  in here and what does that change furniture and household and now if we go to view this page will will see is that  this will have all of the contents of the Master page just like we saw with the other pages and there s a few  nuances here notice that I did not assign a master page declared Tivoli here and what that does is it prevents us from going into the design mode  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And seeing the representation of the Master page in practicing in an era creating the content control hot because it needs to be in  the context of a master page so we could go in here and go to the Master page file at the root and in  their pick the default master and then if we go to the design mode we would see the contents of the Master page merged  with our individual page so where this is is more useful this programmatic approach is when you have a safe standard Master page and  then you may have a situation where you want to apply a different master page when the page is being loaded so you can  externalize that to the web config file or you could he bring them in from information database and other situations like that but if  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=84"&gt;Minute 14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Emulated the little nuances are limitations in terms of going at in design mode that you need to have a Master page  file here in the declarative syntax and if you need to set the Master page programmatically across multiple pages on your site  or effect may want to do it in a number the pages another approach to this is to actually subclass the net  page class and set the default page in narrative must say the Master page in their the way we do that is  we would have a class to her website and let s call it a site page at an app code folder and  we need to inherit from the page class lets at an import statement and Web UI and then we need to inherit from the page class  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=90"&gt;Minute 15&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Then within this new class we need to go in and create embedded and if its members are sitting in a sign the Master page  programmatically has to be an opinionated event or earlier in the page rendering cycle and hear what we might do is very similar to what  we had before and we could lead this value from a database Web config file or other location and that s what we would likely  be doing here because we would want to set it based upon the current situation barometer do is just hardcoded in here and then you  can flush out on your own how you might want to read the Master page file from a different location soldiers in the default master  and that will set the Master page file smell in order to use the site page class list at another page to her website and call this one tool  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=96"&gt;Minute 16&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And one didn t do so I get there that do we support them and then the light is that I  m going to select the Master page and it will just take the default master this as our page however I  m going to into the code behind and instead of hat and hurting from system Web UI page will get into  is within inherit from the site page class that we created this is automatically going to a sign that Master page  and we do have a Master page file directive here so that when we see it in a design mode we  get our header and footer and what we want to do however is let s create a second master page and use that one is  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=102"&gt;Minute 17&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Original assigned programmatically at our site page class a battle flush out the concept little bit more for you this also shows us  that we can have multiple master pages within our website project was that a new item Master page in one uses that I  found for an additional Master pages used to have one master page that has my navigation another so called standalone and what this  does is it is made look very similar to the default master but it doesn t have the navigation for examples on the  order to my default master and just take what we have here as far as it did go back over to the standalone  master pays things in and in this one I m deleted as his government would back to the default master and were within it do in this one  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=108"&gt;Minute 18&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Is now and we see we ve added a menu so will he go back over to the standalone wanted to do is take  that many of them out of there so this would be a non navigational page and then I m going to go over here  and instead of default master in the site behind class I m had the standalone so now even though we have the Master page  in tools right here as the default master with the navigation will only run this page we should actually see that it is using  the standalone ouster before you do that let me just put the word tools inside our content control so we can tell were on  this page to now will view tools in the browser and will we see is our header and footer but no menu so it is using  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=114"&gt;Minute 19&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Standalone Master page and just to assure you that s true let s go back to furniture which uses the default master and do that and here  in that furniture page and we get the navigational menu now witnessing the Master page file using several different methods in each individual page either with the  vast page file attribute are with this new site page class and there is another way they can do it if you know that you can use  the same master page file across all your pages in your site you can set it in the web config in fact is that even the majority  of pages are using the same master page if you do that and then you could override it on those individual pages or you want to use  a different master page the way we do that in the web config that stunningly pages element and you can see that there is a Master page file attribute of the pages  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=120"&gt;Minute 20&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Only and only need to do is use fill in information here just like you did in this attribute in the page directive on  an individual basis of a disco default master master and doubtless saw in the default master page as the master for all of the  pages on our website and I m going to take that out here because we can continue to use the individual Simon of master  pages so let me just close this out now I liked the little time on is the issue of communication between a content page  which is your individual page such as furniture aspx and its corresponding master page default master and what s going to default master and  I ll show you what we might want to do he and his page is formatted and would like to do in this page is for some of the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=126"&gt;Minute 21&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Menu and it s so addictive and we cannot leave the header tags as it is for Molyneux in at another give an insight as to  because this is a shopping site we like a list of hot products for just that detects hot products in here and the issue is that  this list of hot products which is in our master page we would like it to be different for each one of our content pages so  for example war on furniture aspx we like to display a list of the hot furniture products up in the header area of our masturbation many  documentation between the Master page in the content page so how would we do that although they go into this Dave and I can make it  a server side control by putting a run at equal server and amusing addition this example you could beat any ASP net control that you have in your  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=132"&gt;Minute 22&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Header file war anywhere else in the Master page having to this ID who don t call this a hot products contact  us and now we have this dude inside of our Master page who want to access it from a content page so  let s go down into furniture and inside the code behind for the furniture of content page lets go into the load  event for the page and in the load event is where we want to dynamically change what s inside that tiff on  the master page so how do we do that well as a couple ways that we could do that and the first  one is this so lets to mention a new tribal animal coaches call this a hot products and will to mention this as a system Web  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=138"&gt;Minute 23&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;UI HTML controls guide html generic control and this is could be our artist injected control to  the master page and organist at that equal to in the page object Thursday in master page  property and this represents the master page so the end and on the master page renews fine  control and controller want to look for is the hot products content to no hot products variable  represents the gift on the master page and we could just go to hot products inner HTML  and inside here we can put any HTML that we would like and let s just put the furniture hot product  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=144"&gt;Minute 24&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And then represents so I was getting a list of the database wherever and of the hot furnishing products and displaying data  inside of the diff tool view the first page in the browser and indeed we see that the French hot products text  is being inserted into the header of the Master page so that s working the way that we want to just assure  you that that should let me comment out fresh hot products they and minorities summoned that Texas is the page again and  we ll see this time it just has hot products on comment this of this approach works good it does require us  to know the actual name of the give ID in the Master page when we re finding that control and well it works its  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=150"&gt;Minute 25&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Believe not the best approach because if we need to change the name of that gave on the master page  then we have this intimate relationship with all of the content pages that might access that do so a better  way to approach this ID to expose the contents of that do has a property of the Master page in  a status similar to having no exposing a the actual variable in when your classes as compared to exposing the  contents of that variable through a property in your class muscle back over to default master am going to go  into the code behind Faulk Master and let s enter property here so public property and calls is a hot  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=156"&gt;Minute 26&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Products and content as it is framed and what we want to get here it is in  the hot products content did so will say I you wouldn t have a problem like to  see is a mechanical top products content for sets the name of fictive so when they go  over into the master page and underwear is it right here and we ll just call this  container and will solve the problems will go back into the code behind and will call is  hot products content container inner HTML so that s going to return the contents of it and  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=162"&gt;Minute 27&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Could do a very similar thing you forgot to return and I go through to get out here and say this is  a hot products content container and we can assign the value inbound value to that end we just need to put the  inner HTML there as well and it now looks good to know if encapsulating your duty and is public property on our  master page and we want to access that down on our furniture page 1 order to do that we need to do  what s called strongly typing and master page we need to go into the SPX and we need to add a directive  that called Master type and Master type needs to point to the page the master page that is some are pointing to default master is  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=168"&gt;Minute 28&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Star Master page that contains our hot products content property so now with the Master type attribute in our furniture  page now to go back to the code behind for furniture and let me just comment out this first approach  that we did and only to hear in a sample source code for you if you want to see that  approach and now we go to the Master page object here in the code behind the sea that we have  direct access to that public property hot products content and we could assign and new hot products who products for  furniture to that now only view the page you should see this text in our master page or should I say in the messed up  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=174"&gt;Minute 29&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Each area of the furniture page lets you furniture his jacks and indeed here we see the tax in our header area of the Master  page while reviewing the furniture ASP next page is probably a better approach in that it s kind of abstracting away in ashes abstracting away  in the Master page to a public property to look at a number of different aspects of master pages of both how to create them  and how to use them within individual pages I think the next step for you is to download the sample code that comes with this  video look at it in and plan out how you would like to use Master pages in your website and an use some of the  sample code as a basis for implementing your particular approach this is Chris tells thanks for watch this video and using Master pages in ASP net  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_21&amp;&amp;bookmarkIndex=180"&gt;Minute 30&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;     Of rule  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/videos/video-265.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-4234107246683142846?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/4234107246683142846/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=4234107246683142846' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/4234107246683142846'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/4234107246683142846'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-how-do-i-work-with-master-pages.html' title='Video: How Do I: Work with Master Pages Declaratively and Programmatically in ASP.NET'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-6549816571514595420</id><published>2008-08-31T19:59:00.019-07:00</published><updated>2008-08-31T19:59:30.942-07:00</updated><title type='text'>Video: How Do I: Create and Use Application Level Events in ASP.NET</title><content type='html'>In this video Chris Pels will show how to create an Application Class File (Global.asax) that contains application level event handlers such as Application_Start and Application_BeginRequest. Then the sequence of application level events in the application lifecycle will be discussed as a basis for determining where certain types of operations would be best performed during the application lifecycle. &lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_20&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Role just as this you will learn how to use Haitian little offense in ASP net this gets sorted by creating  a website and this simple websites in Visual Basic and if you download the sample source code you also see these  same demo website I m doing here in Visual Basic and see sharp in order to use application level events in  an ASP net website you need to have what s called an application level class and you add that class to  website by editing a file called global aspx Citicorp to the website and at a new item to see here on  the list of templates is one called global application class and that adds the global ASA X Files Sawyer that tour what  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_20&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Website of the global ASA ex is a class that extends the HT keep the application class and the first time a user visits the website the  global ASA ex is compiled into a class in a subsequent visits that class is automatically loaded so does have to be recompiled however for example if  you change the global ASA accident replace it up on your website then the next time that a user visited the site he would get recompiled again  and stored on the server as you can see Visual Studio has added several stubs for some the application level events in a following naming convention is  very similar to the page level of density might be familiar with so its application_in the name of the event soon as Casey at the start and  an era in you also see that we have some session state offense here so the global ASA ex is also where you would add code to have been  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_20&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Tap and when you begin and end the session plus get started by showing how you would add some code to  one of these events in which might use them for a number to come back and talk little bit about some  the other events are available in the sequence these events occur in so let s do the applications start event ending  here what we re going to do is store several values in the application state so will say application and the  first from the store is the title of the application in a set that equal to highway use application level events  and the second one will produce the counter for the number of users or say application number users and will set that to zero in  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_20&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Delay and let s put a third one called application counter and this is just in account the number  of times the application has been accessed will set that to zero by default as well just format the  code you re little bit forgone into our next step want to do is add some code to the  application begin requested and to do that I need to add a sub here for that event is one  of when they do is just copy the applications start and pasted down here below and then we ll  change the name of the event has said the naming conventions this application_event name just some simple just put begin requests  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_20&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Or application variable and application state so we ll do is to say application application counter  is equal to and this is an integer but it s stored as an objects organ  have to change its type so we ll do is we ll say seat type and  now get the application counter and will convert that to an insecure in limbo incremented by  one know what we should do here as well and is licensed for accessing the application  for a blue one and make sure no one else is doing that slightly below lock and unlock and  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_20&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And once for gun wallet locket knowest do something similar for the number of users down in these sessions start  so will copy this could end the session start pace in here and let me to scroll up and won  t change the application counter to the number of users so what this will do is every time the session  starts to increment the counter for the number of users is now let s use the information restoring in its  application variables are the aspx page in what I ll do is purchase through the code bind let s go  to the pre render event at that and what we ll do is just right out a few of those pieces of information  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_20&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Sadr Raitt and personals at his title equals and with that will go into  the application object and get the title information that we stored this convert that  to a string and for the second one will get the counter which is  the application counter and will just get that value string as well and then  for the third one will will do is just right out the users are  able to hold a user as equals to them will get that value from the application object  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_20&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Now or what is are just going to put a few breakpoints so we can see when these different events are fired will  put here in the applications start begin request and down in the session start to let startup the website and will see that  the first event is the applications start as you might expect simple store information will let it run from here next hit the  beach in request as the requests for the default aspx page is processed and then we start a session so we reach these  sessions start at the end let it run from here and you can see we have be the title of the events or  application counter of one and the users equals to want from it do is just refresh the page so we should get at another root  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_20&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;But we should not increment the users because that s in this same session preference is to let things run here begin request and as you can  see the counter equals to indicate that the begin request event was hit a second time as he saw it with these three events that we implemented  that there is a specific sequence in which these events are fired such an important consideration when you re designing your application and overall there is almost  20 application level events and I m not indigo for them one by one here or visit page or an MSDN dad has a good overview of  the ASP net page life cycle as well as some information about the application level events let s go over and take quick look at that here  s the page and I ll put a link to this page in the source code as comment so you can access it when you download the sample source code  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_20&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Tell with an overview of the lifecycle of an ASP net application goes to the major stages that occur and down here when it  gets to this stage is what s called the processing by the HT key the application pipelines and during this part of the processing  is where the application level events occur in senior number three is the begin request event that we used in the demo just a  few minutes ago and that s followed by a whole host of additional events in his events related to authentication authorization to caching than  some about state that session state and down your number 15 is the actual processing by the handler and for example it s a  page of this is where the page processing it occurs multipage level of and so are fired and then that s followed by several posts handling requests for the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_20&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;State and some other aspects of the application lifecycle is a section here about the lifecycle events  in the global ASA asked that we ve been talking about and it lists the major start  and end events for the application and it is right down here and you can see here  is the application_event name convention that we talked about for specifying the events in your global ASA  text file legal appear to the top of our script and will display the comment line and  I ll paste in the URL right here and open no right above it that says ASP net  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_20&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Or event name and then insert the appropriate code to our process for that event and we did some relatively simple operations here just writing to  the application state object because of a pretty broad nature of events that are provided you can really intervene and do some pre powerful things at  various points in the page processing if you ever need to do so so that the real focus in using application level events is in learning  what the page lifecycle contains for an ASP net webpage and then deciding which points in the process what you need to intervene to encourage you  to download the sample source code is said it s available both in Visual Basic as we done here and in C sharp I also encourage  you to read the MSDN article on the link that put the top of the script here online sex and get a good understanding of the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_20&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Lifecycle and ASP net  this is Chris tells  thanks for watching this  video and how to  use application level events  in ASP net of oral  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/videos/video-251.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-6549816571514595420?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/6549816571514595420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=6549816571514595420' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/6549816571514595420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/6549816571514595420'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-how-do-i-create-and-use.html' title='Video: How Do I: Create and Use Application Level Events in ASP.NET'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-471846895247145608</id><published>2008-08-31T19:59:00.017-07:00</published><updated>2008-08-31T19:59:29.942-07:00</updated><title type='text'>Video: How Do I: Save and Load View State Information for a Custom Web Server Control</title><content type='html'>In this video Chris Pels will show how to persist and restore information in the ViewState of a custom user control. First, learn how to persist simple values containing .NET primitive types such as String, Int32, Boolean, etc. Then see how to persist complex types such as Class which contain properties storing information. The sequence of processing View State information during the lifecycle of an ASP.NET page is also discussed. &lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Of role is just as this digital original decision reserved you see the custom user control let s get started by  creating a website and this website in old code that comes with it is available in the download that comes with  this video seeking get it downloaded and then look at it in more detail to want to do here in our  website is create a custom user control him and called his number info no member info is a user control that  we re going to use to store or I should say display some user information on every page of our website  end of this website are retreating is a shopping based website and when the user first visits the site logs in the site will retrieve the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Member information from the database and display it in our member info user control in and on subsequent pages or post backs of the same page rather  than go back to the database and retrieve the member info every time or wouldn t do is write some code that takes that member information and  process the review state of our member info control some ago into the design mode for our user control mode want to do is display several pieces  of information about our member in this user control so what I m going to do is add several labels to the design surface of our youth  control than the copy and paste this first label so we get several here on the youth control design surface now let s open up the code  behind for our user control in this support will do our work in terms of interacting with the view state associated with the user control suppressing an  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Do it in our code behind class is at a private method called load member info blog and do here in November and so  is the first time through this method were going to get the member information from the database and for the sake of this example  code were not related to go to a database which is a hard coding assignment of some values to the labels and then will  persist back into view state and will we wanted to hear and member info or load member info is test to see whether or  not the member information is in a state if it s not that we get it from the database it is in use day  to be loaded correctly into the labels from the view state center that we would say something like if need to view state and obviously he is  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Property of the use control there s also the same property on a page that contains the view state information so in this case  may die to state represents the view state for this particular user control in the view state is a certain type of collection called  a hybrid dictionary that contains a name value pairs so in this case for the view state if we want to to add a  particular value we would put its name so will test for the member name which is a view state property or item that were  going to be storing him will say if me view state member name is nothing meaning that we do not have a member name  items in our view state property then that would mean that the view state information is not available and will put in else and here  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Which means that the view state information would be available toward him and do it if the view state information is not  available is within a simulated loading the information from a database and storing it in the view state s homage to a  comment to that effect will save load data from database and store in view state and what we ll do is just  hardcode values here for sake of simplicity so we ll go me view state and the first thing that worked in a  store is the member name and all sign that to be Joe Smith the second thing there were no store in the  view state is an item called the last visit and will set that equal to a daytime celebrities make up the date will just say 1120  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;2007 had 10 in the morning next thing in the view state will be the total  budget has said this is a shopping site so this will retrieve the total budget available  to the user from the database and in this case won t put a 500 the  next thing we ll get from the database and store in the view state is the  items purchased and this is the number of items that the user has purchased a make  that equal to 10 and OS X will this play is the amount of money they have spent year to date  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;This user has been 2500 Sunday thing we ll do is to loot the view state information into the labels on the page and to do  that when I m going to do is have to get rid of this else statement and what we ll do is have the if statement  just simulated loading the data from the database the first time through and now will take the values from the view state and assign a key  to the labels on the page will say label one txt the animal sign that to me view state and it s as simple as typing  the name of the key in the view state and in this case converting it to a string and assigning it to the label someone go  along here and do that for the rest of the labels that we have the second thing that worked and I have is the last visit  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;To string and I might go back once I finish this and will  make these labels a little more complete so let s take a label  through a head that will take the view state value total budget string  label for will be the items purchased and the last one label five  will be equal to the unity purchase now that will just display those  of values in the labels and for some of these we might want a little static text that  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Well when you do here is a last visit in head that  it will leave the member name has said is in her hair  will put the total budget and bowl Ashlee says total available that  s what this one represents a bad number of items purchased your  items purchased and total purchase of anything we need to use call  this lewd member info method somewhere when used control is being constructed  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Earning the page processing back on the server and it is important where we call this number to call it in  me the pages or user controls load events may put an the load event here and there we go we have  a load event now and in this load event will call load member info and other reason is important that we  called this in the load event is that you need to understand in the cycle of page processing back on the  server when did you stayed he is returned back to the user controls and white when it is saved and when  important distinction is that the usage information that already exists is not available in the end it method for the page or  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;In this case the user control so that if we have put this little member info method in the page_in it for the user control then reviews  the information would not be available and we would get behavior that we expected whoever the page load event does occur after the view state information has  been restored to the view state property or object in the user control so that s a good place to load this member info in the lesson  we need to do is put our use control on the default ASP ex page so will switch over to that go into the design view and  I m going to simply drag and drop the user info a STX user control on tour page than the last thing we need on our pages  to have a post that said to do that learn to do is add a button to the page walked into the standard controls will get a button and drag  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Drop that on tour page now let s does have a page and before I run it let me go over to the code behind for our  member info using controlled set to break points the first online 10 witches were simulating the load of the member data from the database and storing it  in the view state and the cycle output here on line 17 which is where were assigning to use the information to the various labels from the  page or in the use control so now let s start up the webpage and see what happens and as we might expect the first time the  page is loading we hit the break point where we re storing the member information from the database into the state will let it run from here  next that stops down here where we re loading the view state information into the labels on the page and let it run along and are page does  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Displayed the year member related information suggests what happens the first time the page is loaded now let s  click the button to have a post back of this page and see what happens click the button and  notice this time we bypassed the step we were loading the information into the view state because our test  here of whether or not the member name item is in existence in the view state is true because  it is there so we skipped the if clause of data loading go right down to loading the information  from the view state and this will go along and load the information from each of the items in our view state  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Came directly from the view state object let me shut down the page and in this first pass  at using the view state what we were doing is sort storing strings in as each and each  item of the view state one item per string value is another approach that I want to show  you that might be a ore powerful and more versatile and your particular situation sold to a simple  demonstration here were going to do is within at a class for a website project and wouldn t  call this class member at it via code folder and insight of member we re going to create a public  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=84"&gt;Minute 14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;To these values us over for a slumber didn t do is be_member name as  string and then were given to private_last visit as a string and create a call  total budget and then we ll create one called items purchased and ashy goodness the  total number of items over to make that an integer and total budget will make  data and ensure us well in the last thing is usually purchase private_YTD purchase and  I will just make that an inch color screen of public property for each the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=90"&gt;Minute 15&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Is so low public property member name as string  and we will return_member name and will set_member name  new and annexed property will be less visited Senegal  long pre properties for each of these public property  and the last visit as a string will return_last  visit set_last visit next when its total budget as  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=96"&gt;Minute 16&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Teacher will return_total budget said total budget and we have  items purchased in Mexico s public property items purchased that  is an integer and will return_items purchased said it and  I think you ll probably recognize we re going to  go with this is what can actually store the object  instead of the individual values Celeste property is used the purchase  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=102"&gt;Minute 17&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;10 inch stir in and returned why TT purchase and set it to know we have an object that  represents the values that we have for the member and forgot to set a value apparently just do that  and check to make sure the other ones look good in which they do so now we can go  back over to our class and instead of sitting the individual values See is the member object to be  created so a lot of it do is just comment out this part in this part so that when  you download the code you ll have that to look at symbol will do here is first book printed in sin  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=108"&gt;Minute 18&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Of our member object soul city game member is instance of  the member equals new member Nelson at each of its properties  civil saying member member name equal to this time you some  different values so will say Jane Doe is a member last  visit equal to 12 one to rather to rose 7 and  member total budget equal to thousand dollars say member items purchase  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=114"&gt;Minute 19&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Equal to 17 men last Will said Waikiki is equal to 4000 or since a 4000 then will  we need to do is reduce me to say me you got few state and called this item  member and we ll said that equal to the instance of the member object going down below mobile  to his access the values of the member object fully need down here is to get an instance  of that member object from the view state so we ll just for simplicity will create another variable  colas member info as an member class said that equal to does another use case we have converted  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=120"&gt;Minute 20&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Will say seat type and what can be done view state to 10 member item  and convert that to type member and now we have our member object now we  just have the label text again missiles and label one text equal to member info  to member Nate s little able to do tax equal to the member and throw  last visit and won t go along this time of the symptoms of their labels  that we had above so we ll say last visit plus member info last visit  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=126"&gt;Minute 21&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Will go label three equal to total available plus member info  that was total budget and that s an image teacher so  just can say to strain in and we have a label  for tax equal to items purchased in Tibet will set that  he is a member info to a items purchased to strain  and the last one label five text will set equal to the total per  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=132"&gt;Minute 22&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Just and will get the value from the member info objects and said that the strength so this should give  us in essentially the same thing that we had before but it s storing a complex object in our view  state is one thing that we need to do here and that is we need to make our member class  serializable because these state works by taking information serializing it and then basics base 64 encoding it and putting it  in the view state and by default or member class for members of the instances of our member class will  not be serializable sluts go back over to her member class and let s add that so will set you serializable and now  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=138"&gt;Minute 23&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Member class can be serialized by the view state process will back over to her code behind or use control let s just make sure that  we have our breakpoints set you take away the old one left one here when were instantiating the member info object and will put the other  one up here where were storing the information first time through in the last thing we need to do is to change the if statement religious  will confidence the clipboard in the comment this one out and put that in right above it and if you ve been following along to see  that we have to test here for the existence of the member item right rather than the member name item as Phil said to test this  out as fired up in the debug mode in the page starts to initialize and then load and first time through he can see where it  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=144"&gt;Minute 24&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Stanch eating our member object and assigning the values to the properties will just add to member name to show that it is doing that  now they ll let it proceed down for second breakpoint here we are retrieving the instance of the member object from the view state and  converting it to an instance of type member step to that and now we re going to get the member name value from the property  of the member info object will step in here hoaxes hover over member name and you can see it does have Jane Doe the information  that we put in previously stepped out announcing to do that for the rest labels will just let it run from here outcomes are paid  with our values on the member information lets post back click the button go over here to Visual Studio you can see it has skipped the initial  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=150"&gt;Minute 25&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Loading of the information into the member object it s just retrieving our member object right from view state and will step in to member  name again and to show that indeed the value chain dough is still inside our member object stepped out will let it run from here  and outcomes are page with the member information that was retrieved from the view state so in summary he can see we learn how to  use the view state property of the user control to store information first example we stored single values strings inside a different items inside the  view state property and then the second time we created a class which recalled member at public properties for each of the values and we  stored the data inside an instance of the member class and an intern the member class was stored in the view state property in this encapsulate the encapsulated  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=156"&gt;Minute 26&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;The data down into a separate class it is important to remember that that class had to be serializable because that s how the  view state works so we headed the serializable attribute to our member class when important thing to add about storing view state in a  custom user control is that if you have user controls inside of your use of crushes a server controls inside of your user control  remember that ASP net inherently stores the values inside user controls as part of the post back operation for example get a text box  whenever the user enters information in a text box that is automatically s persisted by ASP net it s not part of the view  state of the page nor the use control so you would and any information that you put in declarative syntax for control would be persisted so it makes them  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=162"&gt;Minute 27&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;All here or we  had several label controls  if we had put  the text inside the  label as the tax  part of the text attribute  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_19&amp;&amp;bookmarkIndex=168"&gt;Minute 28&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;You use view state and  a custom user control this  is Chris Pelz thanks for  watching this video and out  implement view state in a  custom user control or will  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/videos/video-250.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-471846895247145608?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/471846895247145608/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=471846895247145608' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/471846895247145608'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/471846895247145608'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-how-do-i-save-and-load-view-state.html' title='Video: How Do I: Save and Load View State Information for a Custom Web Server Control'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-2868568138921635739</id><published>2008-08-31T19:59:00.015-07:00</published><updated>2008-08-31T19:59:28.897-07:00</updated><title type='text'>Video: How Do I: Read, Write, and Delete Cookies in ASP.NET</title><content type='html'>In this video Chris Pels will show how to read, write, and delete cookies in an ASP.NET application. First, learn the basic operations for manipulating cookies. Then learn approaches to storing multiple values in a single cookie using name-value pairs called subkeys. Next, learn how to limit the scope of cookies to a particular application domain or folder. See how to modify values and expiration dates in existing cookies and how to delete an existing cookie. In addition, several considerations for using cookies are also discussed. &lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Of whole is just as this you will decreed use cookies in an ASP net website to get started recruiting website as  many of you know the cookies are small pieces of text that you can associated with a website which are transferred down  to the user s computer and stored on the hard disk when the user visits a page on the website cookies can  be useless for storing small bits of information like identifiers for the user last date and time the user visits the website  and other similar pieces of information score going to do is open up the code behind the default is checked page and  I will head a page load event and in the page loaded and what we re going to do is demonstrate various way  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;He said you can t create and manipulate cookies on his website before you started looking at how to create and use cookies and should understand some  of the limitations of cookies first is that they store relatively cited a relatively small amount of information up to 4096 bytes also most browsers limit the  number of cookies associate with a particular website and that it is typically around 20 cookies and an overall there s a limit that the browser imposes  on the number of cookies across all sites and that is about 300 cookies so consider those factors when you start to plan how to use cookies  in association with your website and the lesson of cookies is that all the data is stored as text so it s available for access on the  users computer so you would not one is thorny sensitive information in a cookie just information that helps identify a particular user or less visits the site  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And other non critical information in case user musical key laws resides in their website as a way to send the cookie information down to the browser and back  up to the server in a secure fashion but even though it s secured during the transition process the cookie is still stored as plain text when resized on  the user s hard disk the first to look at it is having to write information to cookies and then have the cookie sent down to user s browser  and hard disk and all the cookies are stored in a cookies collection which is in the response object so here on the page if we enter or use  the response object will see there s a cookies collection and then there are two ways that we can add a cookie to the cookies collection one is tedious  to explicitly declare the name of the cookie for example let s say this cookie is just what the daytime of a last visit so called a cookie a less  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Visit and then in one of the properties of the cookie is value and wall sign to the value property the  current daytime so will say and value date Time to now and we ll said it to strain because remember cookies  always store information as a string value only other commonly used features of cookies is to set an expiration date in  time for the cookie and the way you do that is to access the cookie and said to a particular proper  property related to expiration so let s get at this cookie that we have here will sit response cookies last visit  and then we can set the expired property and this is a deep time to innocent the sequel to date Time now add days  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And a whole setback to want to look and happened here is his cookie called less is it will expire one day from the current time and  as far as how this expiration works in that the data stored in the cookie down on the user s hard disk and then the next time  that the brave the user opens up the browser and visits to this website browser looks at the expiration date of the cookie and if the data  is passed then the browser would delete the cookie from the user s hard disk that is another approach to doing what we just did up above  where we access the cookies collection directly and that is the creating instance of the cookie class so to mention a viable call cookie as a TTP  cookie and tool set that equal to a new HDTV cookie and here we specify the name of the cookie in this case will call her last visit and I  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Creates the cookie then we set the same properties that we set up a salute to go cookie value and will set  that equal to the time that now to strength and will set the expires property and will set that too one day  in the future said that one demo we need to do is to add this could lead to the cookies collection of  response objects would just go response cookies Ed Pass in the cookie instance that we created and then this set of statements  is equivalent to the first one where we access the cookie directly now you can store multiple cookies for these same user  s vote will do is add a second cookie here will use the response object to cookies collection directly and what assorted  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;A user ID and the value and will set that let s say equal to 10 on the expire the same as the first  cookie will say userid expires and we ll said that equal to take time to now at one day and so now we have  two cookies down on the user s machine once storing the information for last visit and the other storing the userid number nothing to  find is that if you store just one piece of information in a cookie you cannot use up the allotment of 20 cookies per  website fairly quickly see contained image of another future of cookies that agents or multiple values in the same cookie or so called subkeys  and to store last is a news for IT in subkeys we would do it as follows to take the response object cookies collection  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And this time within in the cookie user data in memory going to implicitly access except  accessing creosote key called last visit and will sign to that key date time now to  string and then for the user ID week ago sponsors cookies same cookie user data but  will do a different subkey and this will be user ID and so this one will  sign a value of 10 and then we can set the expiration date to this single  cookie say user data set to expire property equal to date time now and one day  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Swivel head of days one and this would have a single cookie with the two values expiring one day from  now and as you might see there is an advantage to soy multiple values in a cookie that genetically contains  or packages them up and also he only had said the expiration date once in that expiration date applies to  all buddy values and subkeys that reside in the cookie they can create this using other syntax up above so  they came to mention a cookie call is cookie one as hate to keep the cookie equal to a new  HDTV cookie and called its user data and then in cookie one values value but values and here we can set the less the visit  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Equal to the the time to now to string  and he said a few one that values user  ID equal to 10 and we can set the  expiration and will set that again can now and  head one day and then we had that today  to the response cookies collection head N Y at cookie one  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Time used to request any page in the website whoever you can restrict what cookies are set to a particular part of the  website and that s called scoping cookies and there s two ways that you can scope cookies the first is to scope a  cookie to a particular path and many take one of them could easily create previously and it s just take this one here  slam on 22 handle pasted down below and we ll change it from cookie one to cookie to and then lower going to  do with this cookie to is going to set the path property that will restrict this cookie to a particular path on the  website and just change it one more time now if we take cookie to them before we added over going to do is to  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And cookie to him and what is said in the past property notice can be set to a physical path for virtual path underneath  the website root so this particular case lets you set it to add men so one could happen here with cookie number two is  that it s only visible to webpages in the admin folder and below so if the PHS requested by the user is in the  admin folder they won t get cookie number to send back up to the server however if the page they re requesting his say  in the root of the website or in another subfolder off the mood on the website they would not get a cookie to element  of the ways you can scope of cookie is to domain slits take our cookie one will copy and pasted down below them and they just change that  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;From cookie and 12 23 and change all that and now what we can do is down here after he  expires property to consider property called domain to cookie three will go to domain what you can do here is  you can set the domain to a specific subdomain because by default whenever a user requests a page from on  the website all the cookies for the entire domain are sent back up to the server that we set to  domain it restricts it much in the same way that a particular path setting restricts what cookies are sent back  so let s set the domain to support to my site com and in this case what can happen is that  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And back up to the server if the page is associated with the subdomain support that my site com in this particular case were sitting in domain to  a specific set of domain called support within my site com and we could also set the domain equal to just my site com and then that will  restrict the cookie to the my site com domain and any subdomains that exists within my site com says a variation on using the domain property next with  a look at her week cookies when they re sent from the user s browser or through the user s browser from their hard disk backup to the  server in order to do that what once do a score ground to fall to its PX is putting in design mode and just at a label control  so we have somewhere to put information is coming from the cookies so corned here will take a label drag and drop that contour design mode service for default is  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=84"&gt;Minute 14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Acts and will go back into the code that we have that label control the page in order to read the cookie it  s pretty much the same as when we wrote the cookie so we ll just say if not and the cookies come up  in the request object and a cookies collection and over doing here is testing to see first whether the cookie exists because he  could been deleted down on the use of computer so get at the last is a cookie which we wrote previously an endless  is not nothing then so in this case will no cookie exists and I will say label one tax and most signs that  the value of request cookies last visited cut value which we have sort previously now a good practice since the cookie could have been  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=90"&gt;Minute 15&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Peppered with between the time he wrote it and it coming back up to the server is for lower than it  do is take this text that is stored inside the cookie and Windows server HTML encode and that will help prevent  any malicious code from being executed here on our server and we can also do a very similar approach before by  defining an actual instance of the cookie objects only does copy will head pasted down here and we ll get rid  of this line and if we know the cookie exists them all we can do is we can to mention be  cookie for in this case as an ATT PE cookie and we can set that equal to the request cookies last visit  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=96"&gt;Minute 16&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Their religious change it to a capital L again and once we have that and we can take  our label one text and we can set that equal to the server that HTML encode cookie for  that value and that would be equivalent to the previous statement and we can also access the subkeys  in much the same way that we wrote then some to say if not request cookies you will  take the user data which we wrote down to supper users are just previously is nothing then once  we know that cookie exists because a label one text equal to the server that HTML encode making glad to your requests  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=102"&gt;Minute 17&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Is God user data and the subkey of last this is a hand close off with our final  privacy so this would access the last visit subkey and we could access any other subkeys in a  cookie in the same manner in addition to accessing the subkey value directly with you get added to  the values property of the cookie and that property is actually a name value collection so we keep  dementia local rival we could for example say to mention cookie collection equal to our other as a  system collections specialized name value collection tooth at the request cookies get the user data cookie and then take the values  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=108"&gt;Minute 18&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Opportunity than using a local variable which contains the subkeys with its a label one txt sequel to server HTML encode cookie  collection and the nickname of these okay lets a last visit and that is just a different way to approach getting at  the subkeys one other thing that you might want to do is modify the value or the expiration date of a cookie  and you can actually take an existing cookie and modify either the value or the expiration date on which can do is  create a new cookie of the same name change the value what expiration date and then add it to the cookies collection  and it would overwrite the existing cookie so for example lets everyone to update the last visit cookie will be could do is we could say response  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=114"&gt;Minute 19&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Cookies last visit and set the value it could set this to the current daytime so you  could take a time now destroying and then we could say in response cookies last visit to  expires set that equal to the time now Ed Davies one day from now and that would  update in the last cookie value currently down on the users computer at deleting a cookie is  actually very similar to modifying a cookie again you can directly access the cookie in the user  s hard disk so what we could do is change the expiration date to at date prior to the current time  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_18&amp;&amp;bookmarkIndex=120"&gt;Minute 20&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And then the browser would think that the time for expiration of the cookie had already passed and it would  automatically delete it to do something like this same response cookies let s say we re going at the last  visit cookie and expires property and we would set that equal to the time now Ed days and we would  put a minus one which would make it one day earlier than at the current time and that would cause  the browser to delete that particular cookie now stored as a teaser concern modification of subkeys is essentially writing a  new value to the subkey so the case of user data last visit cookie while we would do is say response cookies user date  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/videos/video-246.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-2868568138921635739?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/2868568138921635739/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=2868568138921635739' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/2868568138921635739'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/2868568138921635739'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-how-do-i-read-write-and-delete.html' title='Video: How Do I: Read, Write, and Delete Cookies in ASP.NET'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-6524083468889081801</id><published>2008-08-31T19:59:00.013-07:00</published><updated>2008-08-31T19:59:27.776-07:00</updated><title type='text'>Video: How Do I: Use Control State to Persist Information for a Custom Web Server Control</title><content type='html'>In this video Chris Pels will show how to store information related to a custom web server control in the control state which is independent of the ViewState information for the control. Unlike ViewState the control state can not be turned off and is therefore a more reliable way to store important information for a control. A discussion of what types of information are appropriate to store in control state is also included. &lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_17&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Hi my names Chris tells in his video when you learn how to implement control state and foreign ASP net user control of control state is much  like you stating that it s a way to persist information related to the use control during post backs to the server whoever controls it is intended  to be used to persist information related to the behavior of the control is used is intended to be used to persist information related to the user  interface aspect plus get started by creating a website with a new website which I m going to call website DB and now put this in a  sample code folder so when you download the sample code that comes with the video I have it and can work with it presently want to do  is add a user control and in the user control is where would I put the functionality to save and restore the control state let s just call this sample control  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_17&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And in this user control and we want to have at least a little bit of user interface so  that you can see the user interface only at the control to a page and the intent of this  user control is to store customer information and will be doing is us saving and restoring the unique identifier  for the customer and control state solicitors put a couple controls on Tuesday user control design surface someone at  a text box and it lets you add a label as well label and put them onto the design  surface and it is a move that and let me just put this label their lets change a property or to  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_17&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Messages but over here for the label go to the label and its coldest so customer name and that ll be  good enough to be spin will see the user control on the webpage to know let s go to the code  behind in the user control this is where I do most of our work now we need to add three things  in order for this user control to save and restore control state and the first thing we need to edit our  two methods an override to existing methods want to save the control state and one to load the controls it so  but said the save control statements here first is that there is it controls the analyst said the load control state  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_17&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Know we have two methods that see it and restore the control state and inherently a  user control does not invoke the control state functionality so we have to indicate that by  calling on method and the best place to call that method would be in the end  it method for the controls so let s said that on and it down here in  on it we have to do to invoke the control state functionality is go to the  page object and you have to go to a method called register requirements register requires control state and then  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_17&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Too bad we have to pass a reference to the user controls or just like me and that  will get the control state functionality going here in our user control and we want to save and  restore in the control state is the unique identifier for the customer so let me just add a  private variable called_customer ID as an integer and that leaves wearables for the primary key for the customer  that s currently in the user control and let me at a public property exposed that customer ID  that will also be an integer and we would return the private cargo and said at a quarter  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_17&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And so that s the value that we want to save and restore in our controls they must now go down into the  control state methods and personal to save what we need here is a way to store the value and you ll notice here  that we also have a currently it s has returned my base save control statements about to say that this cool site of  the base class and in the state controls to nothing but you need to do is as a return value you need to  pass the object that you want the control state is safe for you so organa do hear his changes around a little bit  and her family to its convention a variable which will just call control state has sent an array of objects and then we ll going to do it  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_17&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Is taken this and rather than return it and what can it do is produce a control state and in the first  element of the control state organists Dorothy controls the information for the base class and then in the second almond were going  to store is our customer ID value and then when we re done with that he will appoint a return is the  control state variable or object which will contain both the base class controls the information as well as our customer ID so  that gives us us to safety controls the information that we want now let s go down to the lewd controls they  had recently wanted to the inverse of what we didn t save control state so the first thing I do is to mention a local variable  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_17&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Control state as an object and McGuinness said that equal to this inbound safety state parameter which is the state  information and we want to change that to an object s older lessee tied to a safe state and convert  it to an object and then the next that we want to do is in the base class load the  control states rather than passing a safe state will want to pass here is the first element of our object  array that contains the base class state information and then what we need to do it is to our customer  ID value what we want to assign is the control state the second element of the array and then needs to be an integer so  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_17&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Let s convert that to a nature so that shouldn t elude the control said information into the user control so we looked to be  all set here in terms and planting a save and load control site functionality lets open a bar or default aspx and what we want  to do it here in order to test this out is to take our user control the example control drag and drop it onto the  webpage and there we have our user control that we need to add a couple more elements here to test this out and the first  one that I want to add is a label and what can I do with this label is simply assign the value of the customer  ID so that we can have an indicator that the user control is properly saving and restoring the control state and let me go back up to  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_17&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Assigned service to customers one more thing that we want to put on here and that is a button so that we can use a  button to post back to cause the page to post back so that looks good for the default ASP ex page let s go to  the code behind and wanted to be and here is when the page loads we want to get the value of a customer ID and  put it into that label control so we can see what value is so we ll do that in the low defense let me at  an event handler for load and then we ll were going to do here in the load event are actually two different things in the  first one is that we re going to take the label one text and two that were going to assign to it the sample control  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_17&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;customer ID now having compiled as if to see customer ID property from that user controlled on a type in because we know it s there  and then the next thing that we want to do is intimate to a customer idea but it does compile this so we get rid of  that era and the next thing we wanted to his take the sample control customer ID and we just want to increment it to say plus  he calls one to what this will do is whenever the page loads it s going to display the value of a customer ID in our  label and then it will increment to storing it to the user control and user control with this works according to plan will save the incremented  value in the control so that next time we come into the page it should load that incremented value so the page should show us 012 etc  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_17&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Before we test this out let s go over into the sample code user control and let s just put two break points won here in a safe control  state and one in the load control state is let s start up a website and look at our sample page and the initial value should be zero and  asked him to come in to save control state the first time the page is loaded onto slip that run here s our page with a zero which is  the first value of our customer ID since we by default and assign anything to its old post the page back by clicking our button and let s hop  over to Visual Studio It has a breakpoint in load control state is the page is being loaded and if we step down to hear the first thing it  does is load the base class control state and then it s going to load our customer ID and let s just hover over customer ID and as you can see it  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_17&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;You is one which is incremented value that we stored on in the load event for the page to let it run  from here and here we are coming in to save control state and is going to store the incremented value which in  this case should be to select its let it go through and customer ID and tedious to solicit a store that in  to the control state will let it run from here and you can see that the value and is now one on  the page when it was zero previously and if you continue to post the page we would see this increment two to  three and so on to senior out to implement the saving and restoring of control state and in this particular example were storing a single value in  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_17&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Is the customer IT and you can store anything in the control state because it saves and restores an object and one additional coach that  you take when you get to sample and suck implemented in your own code is rather than storing a single value such as customer IDs  create a separate class let s say we created a customer class that had multiple properties to it and then we could store that caught  in an incidence of that customer class in the control state which will provide us with a lot of flexibility to store multiple values so  encourage you to download the source code that comes with this video take a look at the sample man and extended from there to meet  the needs of the your particular situation as is Chris Pelz thanks for watching this video on how to implement control state in an ASP net user control  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/videos/video-241.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-6524083468889081801?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/6524083468889081801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=6524083468889081801' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/6524083468889081801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/6524083468889081801'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-how-do-i-use-control-state-to.html' title='Video: How Do I: Use Control State to Persist Information for a Custom Web Server Control'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-6313453187924155634</id><published>2008-08-31T19:59:00.011-07:00</published><updated>2008-08-31T19:59:26.754-07:00</updated><title type='text'>Video: How Do I: Implement a Custom Health Monitoring Event</title><content type='html'>In this video Chris Pels will show how to create a custom health monitoring event that extends a standard health monitoring events in ASP.NET. The custom provides additional event information and formats it for a health monitoring event provider. A custom HTTP module is then created to raise the custom health monitoring event explicitly since the .NET Framework only raises the standard health monitoring events. In addition, the custom health monitoring event is raised explicitly in the page behind code for an .aspx page. &lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Pie this dispels this video you ll see how to create a custom health monitoring event for use in application where you have  to record information is not typically found in more than a standard web events use for health monitoring after we create the custom  event will also see how to raise it in your Web application lets get started we need critical as library project which will  contain our custom event will create a class library project in Visual Basic will hold HDI Web management and we ll put it  in the VB sample code folder that comes with this video for the first single going to do is add a reference to  our project because we need to have system Web then wedded to import statements to class for someone can edit system Web management  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And a namespace that contains a lot of the classes for health monitoring  will also lead system Web Anglican and system text now let s rename  our class to a custom Web request event now he won t have  our class inherit from the Web request event which is in the system  web management namespace in this base event for the Web request events in  health monitoring the first thing we need to do is to create two different  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Structure is for our custom Web request event class opinion the first one you were given and taken down on message  as a string and event object data as objects in the event food as an integer then we re going to  call the base class constructor and we re going to pass the message event object and event code and let s  let me just change this drive will name to source so it matches the one that s in the base class  and that maybe a little more clear to you when you look at the sample code here spend the next thing  we want to do is to create a custom message in our constructor and when you said later on so with  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And create a class like variable to store that so called a private message created as string going to go  down in here and let s have something to that message and we will say anything created to add a  little substitute in to that in the event time to strain and this is a property of the base web  request event class so that was good for our first constructor and as I said we have to create to  these because there s two potential constructors that may come in down to the web request event base class comes  as the copy and paste and we can add a few things to this class in the second constructor to  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Say that additional prevent parameter called the event detail code as an immature and then down here in  calling the base constructor we passed the fourth parameter of the event detail code and will leave this  created message which we also want in the second constructor semantics that we want to do is to  override the race method which is where it will record the custom information for our event so sick  public overrides raise and we want to record some custom information writer before we called the base race  method and will we want to do is to edit and other custom message some critics as like the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Pope because we can use this information a little later on in another method and will call that message rays are  in a good down here into our race method and let s create that message will so will set a message  raised and will set that equal to the string format and will say it is the event raised at a never  going to substitute in the time that the event was raised and won t get that from the event time property  of the base class and will convert that to a string so that should be enough information for our custom event  and here in this raise method is where you want to put any custom information that you would like to have in your  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Custom event for the next method of naked men has to do with formatting the event for information hammer to override another event  in the base class will say public and override the format custom event details method surrounded him call the base class with an  edge in some of our own formatting soreness in a formatter which comes in from the base class women to scroll to the  right so you can see that and that is an instance of the Web event formatter which is part of the health monitoring  set of classes and this is provided so that you can format the output of your custom event so the first thing we  re going to do is have a blank line to separate our custom information a little bit in the output so safe string NT  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Them to scroll us up so it s a little easier to see so we ll do that  and now we want to add some custom information so it is a formatter append line and you  will put three stars and will say to start of custom event information in them you just copy  that because county end and you put a similar line of organization and no inherent in a display  art to custom messages that we created up above so the headline and the first one will be  read the message created in the secular will be with the message raise so is the sweat a little section to the event  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Permission whenever this event is his call to which shows a little block of our custom event information to any creature own custom event in  this is where you would want to put any formatting that you feel is appropriate for your event information so solicits that we need to  do to instantiate our custom event records and information in those constructors that won the event was created and then also reports and information whenever  the event is raised and finally how to format the event information when the provider request that it be written out so now let s  take a look at how we used his custom event in a web application or website all the standard help monitor and succumbed them with  the net grammar for automatically fired by the framework however when you write a custom event such as who died here you have to explicitly raise it to  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Look at to approach is that the first is we can create an HDTV module that will fire the event  and have also look at how he would explicitly raise the event in a page from yet another class for  a class library project for our HT key piedmont will have what I call this custom Web events will head  and in Port statement for system Web and then we need to inherit from the page class in system web  UI and we also need to implement the I HT to keep module interface and the HDTV module interface requires  us to implement a demo of these two methods for us is the dispose method and in this particular set  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Will we wound implement any dispose functionality from below comment tears when its sample source code with  the video you know that this is where you would any dispose functionality now let s go  down to the end and method and what we want to do and in the end it  method is added to event handlers to the first handler within them is for the begin request  event and law take the context object coming inbound to this method and roll at the begin  request or specify the begin request event and will map that to a then called on begin with  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Bus know we are writing that in just a moment now let  s think that MO the guy also had a handler for the  end request for map that to the on and request village said  those two methods that which is snapped our delegates to the first  full head on Beacon requests and we need to have two inbound  parameters to civilians this in the first so called sender as object  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And the second will be as event arcs in a try catch block and inside our  method of addressing what I do is get the event coder make an event code represents  this event so created a variable event code as an integer and will set that equal  to system Web management whether that includes whether that extend base plus 31st can do is  just create an error code that s outside of the base range of error codes for  the health monitoring system this will uniquely identify our custom Web event that were firing here  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Now let s suck an instance of our custom Web events are custom Web request event class so will create a  variable called custom event and that will be an instance of the custom Web request event class we created a few  minutes ago and is you may recall from our constructor of the first and we want to put his message so  will say this custom event start and a source then we ll pass me because it s this event handler in  the event code is the event to a variable that we just created a few minutes ago appear on line 21  and X11 do is take that custom event and we need to raise donkeys in an exception let s do a little something  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=84"&gt;Minute 14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Care less to mention a local variable and postage to keep you at for application as an  HDTV application instance and within a set that equal to within a convert the inbound sender object  to an HDTV application tangled take that an instance of HDTV application and will take the contacts  response output will write a line out that says this is the exception information by changing the  exception information or converting it I should say to a string that looks good for our on  method and what do the same thing for and requests over disconnect to a quick copy and paste  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=90"&gt;Minute 15&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Change a few things simple peer and change the name to and requests and we will go down in two method over  here and will put instead of starter will put an end otherwise it ll be the same as the star request method  so that looks good for ice GDP module lets compile it and make sure everything works and it does so now let  s create a simple website to raise this event and take a look at it to lead a new website where we  can test out our custom of an HDTV handler for a new website and let s call this website VB and again  is to be in the sample code I took it with a video pressing it into our simple website is at a reference to our class library  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=96"&gt;Minute 16&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;It s then up men in this case within a reference to the project and the next thing we  need to do in our simple website is to add some information to our web config file and into  sections to the system Web element or bar web config file and the first one will be HT keep  the modules and then the second one down the Connecticut HDTV models will be for health monitoring since I  d HDTV models we want to add a new one and will give the name of custom Web events  and animals specified type which is the fully qualified name of far custom Web events class so that would be aged guy web net  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=102"&gt;Minute 17&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Commitment to custom Web events and I will do it for our HT keep the modules section  that as our custom HDTV module meltdown and health monitoring person and two attributes to the health  monitoring element and enabled with innocent truth when able health monitoring and deadly heartbeat interval within a  set to zero so we will not get in a heartbeat advance through and add three subelements  to help monitoring organ specifies some of the mapping information we re going to specify a profile  and their specifies some rules suffers for event mappings so we want to add that name will be custom Web request event  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=108"&gt;Minute 18&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;In Hindi I ve who ll be HT iodide web management custom Web  request event that does it for our event mappings that it adds to  our event that we created over in our class library project now for  a profile and went ahead to a profile and the inimitable call cause  some minimum instances equals one and the maximum limit hold equal to an  infinite and then the minimum and Falwell said to all zeros will cover all that  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=114"&gt;Minute 19&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;I m been done to the rules first knew I d do is clear any existing rules and  never to add a new rule and will close custom Web quest events or event and then the  event name will be from up there on my 19 which is custom web that request event the  profile movie or a custom profile and then the provider will be the event log provider will use  the standard event log provider that comes with health monitoring to write out these events to the event  log so will limit its format this a little bit so it should be all set and ready to  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=120"&gt;Minute 20&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Is not our custom event which is make our website to start a project and we should be good to go sell illustrated tests the custom whether they first  let s go over in Tuesday because Web request event class will set a few breakpoints and we can see things happening set it on the formatting be raised  that it had as well as both of the constructors okay let s start at the website in debug mode and witches have a blank webpage so we will  see anything on the page but here we are starting into the constructor of our custom event will let it go from here and next week at the raise  method where it s creating me a raise message and if I slip through and then show you the contents of the race message was it has information us  at the time the event was raised will let it go on from here gets into the formatting method that we created and it s got a run through this and appended to  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=126"&gt;Minute 21&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Eyeing city event information and let it go now remember the age to keep the module had both an event raised for the begin  requests and requests of who we are with our second invitation of the custom event for the end request event so is cannot let  it go right through this outcomes are blank webpage and the school over to the event viewer and take a look at for fresh  the application events and here we have the two events that were fired by our custom module and first is an instance of our  custom event let s go down here and there s a bunch of information coming out here is our custom event details indicating the  start and end of the process for our event as well as the time the event was created when it was phrase and that is for the start of  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=132"&gt;Minute 22&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;The event or I should say on the begin requests and a look at the second one this represents  the end request and it has a similar information down here in the custom event details such the back  order Visual Studio shut down the webpage that shows us how to use DHCP module to raise our custom  event because as I said before you have to explicitly raise your custom event another way to do it  is to encode and that simply do that by going over here to the VB class behind the default  aspx and let s implement or of the unload method and a non load let us create an instance of our custom weather than  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=138"&gt;Minute 23&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Vendettas and HDI God web management custom Web request event equal to a new HDI Web management custom Web request event  and will put the message as in the page and will say me as the source of the event and the  event code only have to do here is at system Web management very similar process will we did over an ATP  module and take the base and will add a value of 33 thatch represent this event in the page and then  we had to take that Web event and we have to raise the silly looks like Rall set does they are  lemony ashy glop let me believe those of the breakpoint is in the freedom of a relentlessly limitless but another breakpoint here  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=144"&gt;Minute 24&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Are page loads as far up the website again and you ll see that we re going into beyond begin request to  step through this coming in here to our loading of the paper to create a instance of our event when he stepped  into that you see become into the constructor here with our information from the page loads of it is whole bad over  message and there is art in the page of message will lead its step to the different aspects of this outcomes are  webpage looks forward to the event viewer hears are two events for the first time I ran it lets for fresh things  now have some new ones and the first one represents the pond begin request the second one represents the event being raised in a page load method  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=150"&gt;Minute 25&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And the third one represents the on and request back to the Visual Studio lets shut down the website to the spinning example of how  to create a custom health monitoring of and we create the custom Web request event class which represents our custom health monitoring event then in  order to raise and we had to explicitly raise its overlooked in two ways one was to create a custom DTD piedmont of all and  then we went over to create a simple website with the necessary information web config and also raise the event in the code behind the  default a SPX page records you to download sample source code because of this video look at the sample in detail and an adapted to  meet your needs in your application is Chris Bell s of you enjoyed this video on how to create a custom health monitoring event in a  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_16&amp;&amp;bookmarkIndex=156"&gt;Minute 26&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;     SP net  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/videos/video-237.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-6313453187924155634?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/6313453187924155634/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=6313453187924155634' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/6313453187924155634'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/6313453187924155634'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-how-do-i-implement-custom-health.html' title='Video: How Do I: Implement a Custom Health Monitoring Event'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-2735714576899549698</id><published>2008-08-31T19:59:00.009-07:00</published><updated>2008-08-31T19:59:25.675-07:00</updated><title type='text'>Video: How Do I: Event Handlers in ASP.NET Web Pages and Controls</title><content type='html'>In this video Chris Pels will show how to create event handlers for ASP.NET web pages and web server controls. First, learn how to create page level events for the standard page events provided by the .NET Framework. See how to automatically bind the events to a page using the AutoEventWireup attribute as well as programmatically bind the events. Next, learn how to create and bind event handlers for the standard web server control events. Also learn how to connect multiple events for different controls to the same event handler. Finally, see the usage of the AutoPostbackTrue property for web server controls. &lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Tie this is Chris sells this video would you learn how to create event handlers for ASP net webpages and server controls sought to get started  by creating a simple website screed regular ASP to net website in Oregon call this website VB and this will be in the sample code that  you can download with this video suffers you look at is page events in ASP net let s open up the code behind file for this  default a SPX and let me go down here into the page events drop down and over here you can see these are all the standard  page events that come with the ASP net framework in terms of an ASP net page life cycle and if you want to add an event  handler for any of these here in Visual Basic which you need to do is either select the event from the drop down lists in this case the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Munich treatment and handler for the load event or you could manually coded slits like the load event were to do  a simple little experiment here to show you how this load event for the page is connected to the actual voting  of the page let me create a public string variable here with where we ll put a little message and that  will hold a message and then Morgan and do is to let me go back over to default aspx to the  HTML side of things must put a little bit of script here and we re going to say at response write  and write out the contents of that message variable is now let s go back over here to our event handler for the page of a  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And the first to point out is the naming convention for this method as you can see its page_followed by the name  of the event so in this case this handles the load event for the page of the backup to that list the  page of fans if we were to create a method for any of these other events let s say pre render to  see that we ll get a similar method which is page_pre render the inside his load event handler to sign some text  to our message variable was put in the page load event handler and a list of the syntax for this page load  method and let me get rid of the solution Explorer so we have a little more real estate we can see the entire syntax here at winds  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And I mentioned the_event name and then we get these two standard parameters passed into any event the object representing who  said the event and then the variable containing the event arguments in this case it s the standard system event arguments  object and over your on the right side in Visual Basic is the handles keyword that indicates what event this particular  method is handling in this case this page_load method is handling the need to load which views the page to load  event let s fire up the webpage here and will see that this page load event is fired of Opera breakpoint  right here Cisco head and start up the default aspx webpage for the debugger is fewer in here in the debugger  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Assigning a value to our message and then if you let it run from here to get the webpage with our message  displayed so this particular scenario we are explicitly explicitly declaring a handler for the load event to be this page_load method and  now let s go back over to see a SPX page and take a look at the page attribute up here at  top online one and noticed this attribute called auto event to wire up equals false this attribute refers to the capability and  the net framework where the framework can automatically connect event for methods I should say as event handlers to specific events based  upon specific naming convention and first case we looked at humor explicit explicitly declaring the handler for the page load event now  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Auto than wire up this false so whenever auto event wire up is false you have to explicitly declare the event handler  for a particular event now to free changes to true to do right now and we then go back over to our  code behind what we can do is we can actually get rid of this handles on the end of the method declaration  and nail because this method follows the naming convention of page_load and auto that water is set to true the framework will  automatically associate the page_load event of the page load method and now will fire up the webpage again and this time we  ll see whether or not we had out the explicit handler declared and the auto of Esq of equal to true that we get the event handle  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And indeed here we are back down in the page load method even though we don t have an explicit handler attached  and we will get the same message in our webpage now should I expect it to go back over into the page  and make auto event wire people to false leave this method declaration without the handles on it and fire up the webpage  again this time we will not get the message displayed because our page_load method was never called that is one very important  thing to understand about this automatic event wire up and that is if you have this set to true what s can  happen is that the framework is to create and attach a delegate for every single one of the page events in the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Together scenario so far we ve been dealing with an individual page and the auto event wire up attribute what I want to show your  next is let s take this auto event wire up attribute out of the page element and local back over here is the code behind  and let s get rid of the handles on the method again so we have here is we have auto event wire up not declared  as an attribute in ASP next page and we are not explicitly indicating that we want this page load to handle the load event for  the page source happen in this situation is that because we don t have the auto auto event wire up attribute is can refer back  to the default value in machine config which is set to true so we should get the message on the page because the auto event  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Are up in machine config and set to true is automatically going to attached to the paved the page load method here in our code behind just  as if we had auto event wire of equal to true over here as an attribute in the ASP X Files says far this up in debug  mode and you ll see as expected where hitting the page load method because the Shin Bet config AutoCAD wire up is set to true and we  get our message on the page and so far we ve been working in a Visual Basic sample website about like to do next is to create  a sample seashore website because this same scenario works a little bit differently in the sharp language and you it is important to see a comparison between  the two depending on which language you work in or it can work in both swung open of the solution Explorer and the screen another sample website  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Steinberg and do one in the seashore and it is change the folder for  the sample code at McLeod website sees sharp Cisco down a treat our little  response write script for our message for the sort who are code behind and  you can see that we automatically have a page load method created by that  project template so if the quote and created a public stream message variable and  then down here will assign a text that will say a message equals in the page  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;_load event handler is listening to see sharp website are a startup project node lists for this default page in the  debugger and money for break when over your online 17 started up in the debugger and indeed we hit page load  method and we see the message on the page is one thing is different about this and see sharp is if  you notice we have not written any code here to indicate that this page load method handles the pages load event  and that s because bacteria and default aspx or see sharp you can see that the auto event wire up the  attribute is set to true a default which is different than what happens in Visual Basic something set this to false  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And then we started the site again in the debug mode will see we get the blank page and we did that  hit the breakpoint in the pages load method since the framework is not automatically wiring up our page load method to score  the code behind and see how we would add a handler here in C sharp get this page load method to attach  as the event handler for the page load event very get this page load method attached to the lewd event for the  page with auto event where it falls back to explicitly declare the event handler alerted to do that we need to put  it somewhere so let s put it in neon and it methods so too protected override and will go with the on and it can  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;All we ll do is we ll say this being the page load load  event and will go plus equals and will create a new event handler might  tab and then since I ve taken this_default_load which it s being suggested will  put page_load smell this should attach the page load method as the event handler  for the load event to fire up the page and in debug mode and  as you can see we do hit the page load method that are run through  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Handler will go back over to the page and will take out the auto event water equals false analogy fallback to the machine config  and will fire up the webpage in a debug mode and as expected we do hit the page load method is the difference here  in C sharp is that if we want to explicitly attach an event handler we don t have the handles keyword here on the  actual method declaration we have to assign an event handler somewhere else in our code such as we did here in neon and knit  method and the last thing we need to look at with respect to the page of parents he is that we talk about the  auto event s wire up being an act you d hear in the page element it also can be placed in the web config and would that config that  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=84"&gt;Minute 14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Or you would pertained to the entire website rather than just a single page and as the sore machine config that applies to all  Web applications under the current server or installation so for one to sit in the web config config file for RC sharp project and  you would set it in the pages element under system Web Soviet pages and you ll see there is the auto event wire up  the attribute and here you could set it to true or false to those of the three options either fall back to the global  machine config value which is true he said it in the web config so it applies to the entire Web application or you said  in the individual page and it is applied in that order presidency and that the page if it said will take precedence over what  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=90"&gt;Minute 15&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;config web config takes precedence over machine config sonatas included event handlers Web server controls and to do that would go back over  and work on our VB projects from a close down a couple of these windows so they didn t say how server controls  to event handling let s add a simple server control tour page according to the design mood and bull at a button page  of a having a server control to the page we don t explicitly have any event handlers for our button yet if we  go into the source of seed bears the server control markup and there s no indication of an event handler there you go  back over to the code behind we don t see any event handlers now are several approaches to creating event handlers for the server controls and how  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=96"&gt;Minute 16&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Play one of the more common is that people will just double click on an essay about control and what happens there is  the automatically get a button one_click event handler generated and if I scroll out here to the right to see we have the  handles but one God click event added to the end of the method declaration now for go back over and through our default  page and go to source view the CR declarative syntax for the button control remains the same pledges to see that this works  with good or code behind and in our button click event lets take our message variable and let s say you know the  button is clicked or was clicked in the state are breakpoint off of pages load and let s put down your online 12 VB  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=102"&gt;Minute 17&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Website to start a project notes from the website or the debug mode is our button while the click of a button you do  see that we are in the click event handler for the button that run through and we see our message was changed rather a  couple other approaches to a signing the event handlers for their server controls and what I like to do next is in a glory  here am again and take out the handles from this button one click and Ashley to show that this is really different in the  press but in one of the click and a copy that Texas with the new debt in just a moment and now the second  way you can attach an event handler would have over here to the declarative syntax and in the air and can go to the on click event  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=108"&gt;Minute 18&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And over can I put here in the tag or attribute on click is the name of the method that  were mapping the on click event to it in this case don t be put in one_the click check with  silver breakpoint let s fire up the webpage in a debug mode will click on the button and indeed were  still attached to see but one_the click even though we don t have the handles on the end of it  in this case explicitly assigned it in the declarative syntax no third way to assign the event handler possession of  variation on what we just did here in the declarative syntax for the makeover to the code behind and will call this the click to  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=114"&gt;Minute 19&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Can go back over here take out this on click attribute in the button element is quoted in design mode and this is just  a little more graphical way to do it over to the properties window and by default for seeing the properties of the button control  if we click on the advanced button in the toolbar to see the various events that are associated with the button control and will  we can do here is we can actually select any method in our code behind in this case will select but Martin_the click to  it now that is assigned as the event handler for enclave and in fact if you go back over to the source code will  see that he declares syntax remains the same however over the code behind what s happened is Visual Studio has edited a handles button one click to  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=120"&gt;Minute 20&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Our method so as expected if we fire this up to debug mode click on our button we will hit the  event handler right here and the text is substituted on page in the the interesting thing we can do has to  do with attaching the events for multiple controls with the same event handler to demonstrate that let s go over to  the default aspx and let us add several buttons to the page with a way to couple more buttons now we  have three buttons on the page back to the source you their buttons 12 and three now let s go to  our code behind and what we can do is go over here and we can take his handles and what we can do  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=126"&gt;Minute 21&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;History can save button two click and button three click and so what s going to happen now is that all three  of those buttons when the any of them I should say his click here to go to this particular method for start  up the webpage again in the debug mode and that s clicked on a number three receiver down here in the event  handler button to in the event handler as well as by the mod 1 thing is useful when you have an event  handler that is of efficiency that s handling multiple offends you might want to know which button was clicked in this case  and it s a good message sent to the event to which you can do it is if we did mention a local rival  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=132"&gt;Minute 22&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;As a button and we said that equal to a beacon for the inbound sender which in  this case is the is the button to wave button instance of the button object then we  could do something like saying response write and say the button clicked was and we would take  button IT now free fire up the page click on any one of the buttons lets click  on this one order and to the event handler let it run from there and you can  see we get the message that A s but one that s to this one that run through button three  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=138"&gt;Minute 23&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;To the left hand one letter at Ron and that s button to take it in any occasion how you might deal with  the determining which button was clicked and then taking some action based on that knowledge is this shows us how would a server  control event handlers work in Visual Basic is for touristy shark project and take a look at how that function is there because  it is slightly different they closed down the DB pages as open apart to full days to extend the code behind in seashore  lets go and add a button to their way of our button and let s double click on it like we did in  the DB seems to be gay but mod_click method and let s just change our message object to indicate we are in the button click event  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=144"&gt;Minute 24&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;So the it is how is he shark doing with patch for knows the event handler but mod_click to the button click  event because we don t have the handles on the method declaration like we do in Visual Basic so what s happening  is if you go back over to default is indexing through the code behind will see that it s using the approach  of beyond click attribute in the name of the method and then when the page is compiled to see short behind the  scenes it is automatically creating the event handler or I should say that the delegate to the event handler for the enclave  in and we could do this explicitly ourselves as let s take down beyond click in me declaration in the ASP XP  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=150"&gt;Minute 25&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Go back over tour code behind in the uncommented this on a in it and will just comment out the load  handler and we would do something very similar forward to is who is saved this button one click the add a  new event handler and in this case will map it to button one_click cannot say essentially what did the compiler would  be doing behind the scenes with our declarative syntax is just fire this out and see that it works for me  switch the sort of project over to see shark started up and get a page with the button catchy and some  of our event handler for page loads or hitting that this continue on click the button down into the page will begin  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=156"&gt;Minute 26&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And we get the message change that we re in the button click event so how they handle  the multiple controls mapping to the same event handler as we saw over in Visual Basic only comment  to this exclusive event handler creation are back over to default a SPX and let s put that  on click back in and that is equal to the button one_click now let s add a couple  more buttons to this page of scoop back into the source and so one approach since we don  t have the handles on the method over in the code behind is actually to take this and we put this in  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=162"&gt;Minute 27&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;All three of our button declarations now the search page of our three buttons but he just put a breakpoint here on  31 when he taken off 27 b free click on any of these buttons you can see that we get here into  the breakpoint inside the button one click event let it run click on the second one were in their and also click  on the far left were also in their data could take the same approach here and explicitly declared the event handlers such  as I did a few minutes ago appearing on a mate and in fact we could put some of them in declarative  syntax some of them exclusively here in the code and just quickly to point out how the design mode works assault before very similar  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=168"&gt;Minute 28&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;But ill see if we go to any of these buttons and view the events that each of the buttons to set the button  one click so we could ve come here in a design mode going to events and selected the button one click for all of  the controls on the page that you want to map to a specific event handler to look at how to map server controls to  event handlers and see sharp and Visual Basic one way is to put the attribute here in a declaration of these server control in  the area specs page the other depending upon the language either and see sharp you can explicitly declare the event handler or as we  saw over in VB and open up that code behind the commando at the handles to the end of the method method declaration solely event so we can talk  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=174"&gt;Minute 29&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Here are server side event handlers that are fired when the page posts back to the  server and there s one other aspect of this I want to show you when they  shut down the seashore pages will open up the default aspx for VB community website BB  the store project and don t forget to do that is going to design mode and  let s edit text box here on our page in addition to our buttons in the  text box has a default event to select button as the click event of a double click on the text box  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=180"&gt;Minute 30&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Start right here will say in the text box so let s fire up the page and see what happens to our  paid for the text box for me to type some text in a text box on a hit tab to move focus  to another control and that should change the value of the text property which it does but our event is not firing  was the back and look at why we aren t getting the event firing this has to do with what I m  mentioned a few minutes ago that these are all events are fired based on posts back and one of the things that  had to be considered when they architected system is that there are a number of events that occur in controls that are not that the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=186"&gt;Minute 31&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;To associate say to not automatically map back to posting because of his fee every time the page posts there is some overhead in that it  s it that s incurred so what happens is that in the case of the text box at the advance such as text changed too on  not automatically initiate a post back and his property on these control server controls called all will post back and in the case of the text  box is set to false now for change it true what could have been used in the text is modified cars at the text is modified  and that fires the text changed event which the default event for the text box it is going to post back to the server cannot serve  this page and see what happens with your post back set to true let me set a breakpoint on line 20 in our text box 1 text changed fire up  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_15&amp;&amp;bookmarkIndex=192"&gt;Minute 32&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Type syntax into the text box and I will now hit tab to focus out of the text  box which could change the text in a text property and indeed it does post back to server  here we are in the event handler let that run through and we get the response write writing  the in the text box to the page because the overhead required in posting back to the server  you need to give careful consideration to which server controls have server side event handling this is Chris  Pelz thanks for watch this video on creating event handlers for an ASP net page events as well as server side controls  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/videos/video-236.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-2735714576899549698?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/2735714576899549698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=2735714576899549698' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/2735714576899549698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/2735714576899549698'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-how-do-i-event-handlers-in-aspnet.html' title='Video: How Do I: Event Handlers in ASP.NET Web Pages and Controls'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-4275593605014127205</id><published>2008-08-31T19:59:00.007-07:00</published><updated>2008-08-31T19:59:24.380-07:00</updated><title type='text'>Video: #24 | How Do I: Implement Tracing in an ASP.NET Web Site?</title><content type='html'>In this video Chris Pels will show you how to implement tracing in an ASP.NET web site to monitor or measure the performance and to diagnose errors. Learn how to add tracing to an entire web site as well as individual pages. See how to add custom trace messages in pages and business objects to aid in assessing site performance and in diagnosing errors. Learn the differences between tracing in an ASP.NET page and in using System.Diagnostics.Trace for tracing information in business objects. Writing trace information to log files and viewing trace information in the trace viewer are also discussed. &lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Pie this dispels this video were to learn how to integrate tracing in an ASP net application lets get started by creating  a new website and will call this website TV now to enable tracing in an ASP net website you can do one  of two ways you can neither enable it for the entire website and why putting some information in the Web config file  or you can enable it on a page by page basis let s start out by enabling it for our entire websites  can be good web config found to the system Web element and what it had what s called a trace element and  work in a two page output equals true what this does is it will add the trace output to the bottom of our webpage ago also said  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;In a bold attribute to be true to enable tracing and organist at the local only attribute to false which means that the tracing information will use  be displayed to any webpage so that small addition to our web config lets start up the default page which has nothing on her moment in to  see what we get to see that this provides us with a whole bunch of information on our page spread to top BS in information on the  request including the ID of the session the time the encoding type of request as well as a status code which is a W3C value of this  one indicating success from a CD trace information which goes through all of the offense that are fired on our page in order to render it as  well as over here in the right received this is the delta time from the previous steps of this would be where you can indication of how  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;On a particular step is taking in rendering your page with dengue complete list of the controls that are on the  page or these are the Web server controls that are used to render the page they get their size the view  state size as well as the controls a size we also would get these session and application state if that was  available information on the cookies coming in that request as well as the cookies for the response within CV complete header  collection interval header values as well as they see us in detail on the response headers the form collection if values  for their query string and then lastly we see all of the server of the variables that came inbound with this page such as United do  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Simple tracing on your entire website lets take a look at some of the other attributes that we can sit here in the web config file  that control the tracing on the website as a whole were the other attributes is called the request limit and this is an integer which indicates  how many requests should be stored on the server for tracing by default it s 10 lets make it 44 website it can go up to  a maximum of 10 000 and the next attribute them to look at is called most recent and what most recent does is to indicate whether  or not when the request limit is reached or tracing stop that would be false or true tracing continue which would be most recent equals true  and if it continues what happens is that the request limit is kind of like us back in at the most recent 40 requests would be stored on the server  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Let s set this to true and what is their attributes everything said here is called the trace mode and as you can see it has two  options whether to sort the trace output by category or sorted by time by default it sort by time and let s just stick with that for  the moment there is one more attribute called right to diagnostics trace which will come back to in a few minutes after we looked at it to  other aspects of a tracing sweat like do nowadays to create two webpages just demonstrate how you can control tracing on a single webpage so will create  new page and the first one more call just tracing and in that one when I turned tracing on and will create a second page which will  call no tracing and an alarm when I turn it off now because tracing is turned on in the web config file are tracing page will have tracing enabled  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;So what we want to do is hear in the no tracing page lets turn off tracing and as an attribute of the page element called trace  and it s a Boolean acidity of their true or false indicating whether or not we want tracing to occur on his patience as we want tracing  to be off will set this to false when note is that the trace attribute in the page element takes precedence over what s in the web  config file so in this case are trace element on the new trace tracing page will turn off tracing sources take a quick look at these two  pages to show you what the difference is first will go to the tracing page and we ll do that in the browser and this comes up  looks a lot like what we just saw on the default page includes older tracing information have to go to no tracing and review that one in the browser does he read  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Get tracing information on this page so they turned tracing on and off in individual pages should note that this trace attribute  in the page element just turns tracing on and off the different parameters like to request limit etc can only be set  in the web config file for the application as a whole to now let s look at how we might write some  of our own custom trace messages to do that time didn t put a few controls on our tracing page and you  put a fuse link button controls and the first armored in a call a right link to it that IDE will run  at equals server and the text of this one won t be just right link and what is copied and will put a second control  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Does well and this one we re going to call a warning link s defendant s  change this millet scored to the code in the page behind and we want to add  a day event for the page load it in here where you say if it is  post back then were going to do a select case he quests the form for him  ago and we want ahead of the event target for variable and this is how I  was to pick up both the one link in the right link link buttons that we created on the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Symbols a case right link and will do case warmly and then we ll  just do a case else throw new argument exception have more to say and  warning trace and then will throw new invalid operation exception here and we ll  just put a warning trace in the CIA the warning appear where we should  have had rights let s just put right trays on that one and then  let s just take this from here and in day else case will just put  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;General except as a message there were just going to messages sent in here so we can differentiate  where we re landing in these different places now on will want to do it is to put  this in a tried catch block so let s just take the code could appear in our try  and we want to first catch an argument exception and news and we want to catch an invalid  operation exception set to one since then in this first catch Rich is connected to our right trace  from the right link to double or want to do is down in the argument exception which pertains to the right trace  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;We want to do with it ago of trace write a rather every overwrite the unit has three things into  this method the first is can it be a category to scroll down to the overload that we can use  witches number three cicada very will call exception and that our message and this is a right phrase and everyone  actually passed the exception or error information now let s just take that one copy it down here but this  time rather than the write method work and use the worn method we use the same category of exception and  will just change this message to the worn trace and we want to pass in the second exception information poker let s start at the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Page and see what happens when you first put a breakpoint here online eight can watch that code being head start page first  time to post back is false so we do not go through the select case statement page comes up we get our trace  information now let s click on one of our links first let s click on the right link comes in post back his  true steps in the event target for variable hits the right link throws the Excel argument exception down here it s caught now  in a right out of trace message page comes up and I should see now in our trace information we have a new  item with the category of exception and then we have the right trace message which was our message followed by the area from  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;In the air object smell go back up let s just do the warning link as well will see the same thing happens  post back true over until Warren Link down to the exception and I were there right a warning here s our page and  the difference you can see we saw the category of exception all of the appropriate warning information our message and air information but  warnings are in red words the right method clause something that wasn t black so if you something important that you want to  warn about than you would use to warn that it s now I want to do is to create a customer s page  that shows us a simple list of customers in a great view and take a look at some of the additional tracing information that s available in  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Create a new page for the site at pass a simple call as customers and what is close out the other pages and where  one to put on this page a two things let s go to design mode and the first thing I would like to put  on here is an XML data source and the second thing is agreed to an integrated view on to pick the XML data source  as the data source for the great view of the two back into the source view and let s just quickly set up a  little bit of data for this page will get into is in a manually enter a little data in the data element of the  XML data source and I can put an XML structure writing here is a list call us customers and let s put a few customer elements  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=84"&gt;Minute 14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Notice that to add attributes to put first name equals show  and a last name vehicles Smith and will just copy that  and will change if you so put a will put John  Doe and here and put Johnson and will take that one  great to have then we ll put this to be city  Hodges then the less fun will just make Jones and will make that Linda  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=90"&gt;Minute 15&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Him down into her grief you list is said to have a few columns  here and the first column opiate bound field and a data field is the  vehicle for the first name and he header text watches could first name is  copy and paste dad and take the other one the last name and will  be all thought and we will just go one more eye to put a  photo generate column sequels false and let s just go over into the code behind and in our  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=96"&gt;Minute 16&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Page load event Lester said to trace messages will  put a trace write and it will make this  application page category and the message will be loading  page and let s put aside one and also  call this application page category and will say finish  loading page now let s make our customers paid to the start page  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=102"&gt;Minute 17&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;In and what s important to note here is now on our trace information we had to write messages for the start and finish of  the page loading and we get an indication of how long that process takes its prefixes for not doing much in their change that in  just a moment and the other thing is to look down here in the controls tree and not only have a little bit more robust  control you can start to see how useful this information can be so here is our grid view and you can start to see the  rendering size of the review control as well as how much or how many bytes it is taking up in the view state for this  can be very helpful when you have a more complex page to get an idea of what is taking up space in the response of your page that is  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=108"&gt;Minute 18&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Pieces of your page take up the most space in a response object as well as you get a perspective  on how big your view state is and what is contributing to the size that you stay now let s  go back and add a little bit more are going to do is to make a copy of our customers  page and actually what I m going to do is let me add a new page by a slightly different  name customer business object and to save time I m going to do is to take the code from our  customers page and where to put that over in our new customers business object page load event will put that over here as well  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=114"&gt;Minute 19&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;They just is the original customers patiently don t inadvertently make a change else going to the page and what I want  to do this time is communicate the XML data source but we can take the customer information is copied to the clipboard  and it deleted out of the XML data source control itself and we can add a new file to our half data  folder and Excel file record customers and within a paste in the customer XML information to that file so you probably guess  for them to do here is what a loaded from the file rather than have it directly in the data source and  now let s head a new class and in this class would collect customer at its justices can edit via code folder okay let s head  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=120"&gt;Minute 20&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;A few methods inherent in the first one case called to get customers and it s been a  taken a filename as a string and its gunner returned a strength and that also questioned said hey  and constructor method and in the constructor method will route in a duet trace right and notice that  we don t get the IntelliSense so what were missing here is that we re no longer working  with the ASP net trace element or I should say object is what we need to do is  head and imports that does imports system diagnostics and now we ll have the trace class within the system diagnostics namespace  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=126"&gt;Minute 21&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And we won t get a message called customer class is created so it  is an indication when this class is created in an anarchic customers method lets  start out by his having a message that says start getting customer data and  let s put that in a category called customer and engine lets put it  one coal and get a customer data have also put that in the category  of customer or we want to do is to create a variable as it is that XML  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=132"&gt;Minute 22&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;XML document with the new system XML XML document and were then we re  going to load the file name that has been enamored in a returned the  document s outer XML as the strength now let s go back over to  our customer is in a business object page and inner page load were given  to his new dimension a new customer object instance to take the XML data  source one and work in a set the data property on that equal to  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=138"&gt;Minute 23&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Customer get customers method and in the era we need to put a map path for me to set that equal to  be at a data plans customers XML to now let s just ensure that the customer business object is our start page  is sorted out and see what we get and we do get the great with customer names coming out of the customers  XML file but were not getting our trace messages from our business object s let s go back and look at what  we have to do to integrate those messages with our other messages and the reason that we re not getting the messages  from our customers thought he d be business object is because trace object here in our page as you can see as part of system  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=144"&gt;Minute 24&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;trace context where is when we go over to our app code customer VP to trace class that we have here  is part of system diagnostics tool we have to do is integrate this trace information from system diagnostics to display on  our webpage tracing argued that we need to go back over to the Web config file and add a few things  for us and we didn t do is just to ensure that all our error messages are being this blade servers  and custom errors mode equals off and go back up to the top this lesson is really have to be at  the top was imported here so you can see it clearly made to adding new section called system diagnostics and then in their  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=150"&gt;Minute 25&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Want to add a trace element and inside the trace element you want to add the listeners element in  an insight there we want at a listener and really give this a name webpage trace listener that type  you can get from the documentation on adding listeners and that is pasted in here from the documentation that  reduce me to close off that element now on ASP net pages you so that the trace traces are  displayed automatically however one might have system diagnostics trace messages are only displayed it the trace information is compiled  into the applications are rooted to do that we need yet another entry who need to add a section here at  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=156"&gt;Minute 26&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Through the system diagnostics and I ve created a section ahead of time and can copy it from the toolbox because  it has a bunch of settings in a nudist pacesetting so it said element by the name system co dawn compilers  MRK compiler for Visual Basic is what this will do is use the compiler option of tracing equals true or Tracy  post you and I will compile the trace information into our business object Cinelli if we view the page you ll  see that in addition to the ASP net tracing information we now have the customer information in our trace log in  addition to writing these system diagnostics trace information to the ASP trace page you can also do the reverse and that is  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=162"&gt;Minute 27&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;At the ASP trace information to the standard system diagnostics output in order to do that there s two things that we  have to do first is we need to add another attribute to our trace element in a system Web element and that  is the right to diagnostics trace will set to true and this will route the ASP information to the diagnostics trace then  we need to add another listener here inside our system diagnostics element and again I ve copied this from the documentation is  pasted into our web config and as she was living at that inside the listener s element that really reform it does  see this good thoughts are per webpage and we see will see the trace information that was previously closed down the webpage  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=168"&gt;Minute 28&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Governor afresh the website and now we have an HDI trace log file here every open that up don t find any information in the reason  for that is that the listener caches information and it didn t flush it out to our trace log file so we need to do is  to go back up your tour trace element and we need to say oil equals true to flush that information out now free open the log  file after viewing the page again you ll see we have the same trace information in a log file that we had on the ASP net  webpage so this creates a more permanent record of the trace information is it we can do is create a custom listener that wrote the information  out to a database file while lessening alike show you he is called the trace viewer and up to this point we ve been doing trace information and the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=174"&gt;Minute 29&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Webpage images browse this tracing page and this is the type of page we been getting up to this point there s also something  called the trace viewer and if you run TR ACD got a XD in the website where you doing the tracing company of a  page that looks like this and what this does is it lists the most recent traces that you ve run or the pages that  you viewed with tracing and then you can go over your on the right and few details which is the individual data for any  of the pages so we ve seen how to add tracing to the entire Web application as well as turn it on and off  on individual pages and then saw how to write both regular and warning messages using the trace object and then we looked it having a trace information  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_14&amp;&amp;bookmarkIndex=180"&gt;Minute 30&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;To a custom business object using system diagnostics which is similar to but a different approach to tracing in  an ASP net webpage and then lastly we looked at how to integrate the trace information from system diagnostics  to the ASP webpage trace information and also write both the ASP and system diagnostics face information to a  log file hope you find this information on how to put trace information in your ASP net Web application  useful encourage you to download the sample code that comes with this video it s in both see sharp  and Visual Basic this is Chris Bell s thank you for watching this video on implementing tracing in your ASP net Web application  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/videos/video-196.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-4275593605014127205?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/4275593605014127205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=4275593605014127205' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/4275593605014127205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/4275593605014127205'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-24-how-do-i-implement-tracing-in.html' title='Video: #24 | How Do I: Implement Tracing in an ASP.NET Web Site?'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-8371781790952306466</id><published>2008-08-31T19:59:00.005-07:00</published><updated>2008-08-31T19:59:23.029-07:00</updated><title type='text'>Video: How Do I: Implement Health Monitoring for an ASP.NET Application?</title><content type='html'>In this video Chris Pels will show how to implement health monitoring to get detailed run-time information for an ASP.NET application. Learn the powerful and flexible configuration options for health monitoring including health monitoring events, aka web events, providers for storing data, rules for mapping events to providers, profiles for commonly used settings, and buffermode to optimize health monitoring for best performance. Then see a sample web application in action with health monitoring enabled writing events to the Windows event log. &lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Tie this Chris tells in his video would you learn how to implement ASP net health monitoring health monitoring is where ASP  net raises what are called Web health monitoring events also noticeable at events at various times during the course of an ASP  net application these of events range from things like problems with the inbound requests the security failures problems with view state or  general webpage of an error is when these events are raised by ASP net then there are Oracle providers which listen for  the events and then take the information associated with the event and recorded them out to a specific source such as a  database and log file or the Windows event log such it started recruiting new website where will implement some health monitoring A  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;based ethernet website and let s call this website VB and we ll put it in a DB sample code folder list is sorted  by configuring health monitoring which is done in the web config file to open that up and the health monitoring is done in a  section under system Web which is cold and health monitoring in the first element inside of health monitoring their with a look at it  is called the event mappings in UAE health lottery system works is when is the dead net loser beats the web config file and  makes a list of all of the event mappings that are in place and then when a Web event or a health monitoring event  occurs during the course of days today that application refers to the event mappings here and health monitoring element and if there is a mapping then  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;He would call the associate provider for that event and recorded as the first threat to do here in the event mappings is to indicate which of  the standard is taken at health monitoring events we want map tour used in the application and as I said there s a number of standard events  and to help you out in the sample code when you download and take a look at where minute do is paste here in the web config  file a comment that lists all of the standard health monitoring events in religious format that a little bit when we just indent this a little so  it s a little more readable than it looks as though better you can find this information in on MSDN or in the help file but it  s outpacing it would help you for a quick reference for at sample code and you can see there is quite a range of events in the monitors here in the health  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Frank system everything from standard Web failures here are related to security to a offense related to a syndication as well as I  recall that the application lifetime event such as starting and stopping the application to set a world in a given event mappings element  is to nap friendly names to some of the standard Web event classes by default there is onto the net are configured in  a topic of the documentation leading pace than in here about the event mappings element so you ll have them to refer to  in your sample code so for all the standard events were not required to add mappings have been batting subelements but if we  work at one of me copy and paste one in from the documentation as well seek see what one would look like silly hats here for  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Each is there nothing that we do is see a friendly name rituals where we use them in just a moment the fully  qualified type for the correspondent will event in this case the web application lifetime event and I should mention that all of these  are in the system Web management namespace that we have both the start and the ending range for the potential of bank codes  associated with this event swear these event mappings become particularly useful outside of the standard events that are implemented or event mappings or  implement it by default or when you create a custom health monitoring event which is the subject of a related video senatorial are  look at it for the event mappings element is the provider s element and the providers are what we might call the listeners  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;For the events they listen for particular events and then write them out to  a particular source such as the Windows log file database etc not get default  event mappings we also have several default providers are automatically configured in net framework  2 0 have copied them from the documentation money pays him is as a  comment about the provider s element so you can see what they are and  their three of them one is the provider that writes to the event log  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Are for the different providers Sophie wanted to change the value of one of the attributes of these default providers or add an additional  provider is one of the provider classes that comes with the net framework for example Thursday SMTP mail provider which will route information on  health monitoring events to an e mail address that can be very useful than if we wanted one of those or even if we  had created a custom health monitoring provider we ve need to add it to the provider elements here such a show you how you  would do that let s just take this SQL event provider and we ll pasted down into the provider section and let s say  that our connection string name we have called SQL health monitoring and also if this is the only provider that we want more we would meet  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Do is to put a clear element here as well and unique but that before we add the new one because obviously if it was after the edit  would clear up what we have just added to know we have events defined in the event mappings element and we have providers or listeners defined in a  providers element so the next thing that we need to to find here is the rules and the rules are what map the event to the particular providers  slightly so with the providers in the event mappings are several or I should say to rules that are defined by default in net framework 2 0 I  copied them from the documentation and let me pace than he and here is a comment so you can see that they are notorious for the kiss of  the detail the rules and ribs is one more set of information I wanted to put here in the web config file for you in the sample code in  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;To do with the providers equipped here in above the providers I is that the default providers and what one putting here are a list of the  built in providers that are available in the net framework 2 0 so there we go we had the event log provider would talk about the sequel  there is it that you and my mail provider and a trace provider and you can look up the details on how each of those works in  page 1 implement them such the back down to the rules section now and take a look at what this has put a city schools does is  it maps to a particular event by the friendly name for example of the event name all areas comes from up here where we did the event  mappings and all events are on site all eras is the web based vendor and is defined as the default event mapping and then the other at main aspect of the rule  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Is where it maps to a particular provider using a providers friendly name in this case event log provider and that was created up here and as  we saw the event log provider is one of the default providers that comes with the framework so down here in the rule and not the event  is a provider and then you have something called a profile which is set to default in this case will come back and look at what that  is in just a minute and then there s a very important attributes that are set for each of the rule in the first attitude I will  look at his cold minimum instances are many instances in this case it s set to one and what named instances is it indicates the minimum number  of instances of the event before the provider is notified soon as cases in this one instance of the event occurs if the corresponding provider would be notified and end  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Axa Ltd is the upper limit in terms of how many maximum number of times a provider would be notified for a particular event  and in this case it is said to infinite meaning that it would continue to provide event notifications matter how many times the event  occurred in the third XView do want to point out is called an integral and this is the minimum interval of time between when  between two health monitoring events of that means is that the creator of this value the longer appeared of time before the health monitoring  system reports that a particular event occurs and this can have an impact on performance because if you set this value very low to  a very short period of time than you can have a tremendous benefit activity on particular health monitoring events potentially that would tie up  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;System resources and since this is intended to be used at least in one situation as a live monitoring system on and happen up and running application  then you want to try to think about her you said some of these attributes a unified minimize the potential effect on performance the application written in  the custom attribute is something that is used to find you can set that whatever value you want if you are sort particular piece of information with  a particular rule say can see of this works let s quit for rules and assisted by default it to rules above are set so let s  clear all the rules out and then let s go up at in one of these default rules but will change some of some of the parameters  to copy the old air is the fault will pay set in and now let s see what vinegar down and say that it have to be that these 10  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Instances before an event at a health monitoring event is sent to the provider and let s say it has to be a let s  consider the value of one must make the minimum interval for some of the other things to point out appear is in these two default  rules one thing that s happening you should see that both of them are being mapped to the event log provider so you can add  multiple events to the same provider you can also map one event to multiple providers so for example down here in the all arrows we  could map that not only to the event log provider but we could map it to the SQL provider as well connected on over to  look at for configuration is called profiles let s go ahead and add one of those elements here in our web config and what profiles do as the name in  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Eyes as it sets up a profile that can define the specifics of a rule so you don t have to specify that  individual information every time you add a particular rule and then you can just change than one place that would automatically be reflected  in each of the rules let s go ahead and add a new profile and will call this default and the parameters or  attributes that we can put into a profile or essentially these three attributes up here so we can do is on a copy  and paste those down in poor profile and then I can remove them from the rule and now the rule has the same  parameters minimum instances max limit and minimum interval that it had before been so we could have multiple rules defined up here each using the default probe  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=84"&gt;Minute 14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;File that if we went down here and change the minimum number of instances let s say to fly that would automatically be applied to all  the rules that are using the profile to get set up multiple profiles down here that reflect the common parameters that you use in your rules  and then apply them accordingly when you define a rules in the last element that we have to look at for configuring health monitoring is called  buffer modes and what promotes does the success of various parameters related to offering with the provider if we looked up here at the provider element  which we d did a few minutes ago as it is a buffer mode attribute here and it s set to notification currently the buffering is  false for this provider if the buffer attribute is set to Q then you must have a proper mode attribute which specifies the mode of buffering  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=90"&gt;Minute 15&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;For that provider lets take a look at how this notification buffer mode is set up in what the various settings are that you can do down here in  the proper mode element like we saw with several of the other elements there is some predefined buffer modes that come out of the box so to speak and  I ve gotten them from the documentation on MSDN and Lenny Payson and hereabouts up both the bar for both elements seek and see what they are such may  recall this moment only looked at the provider up above it had a bar for mode called notification and here is that a promoted to close at the edit  so you wouldn t have to add it again but if you wanted to change some of the attributes of the notification buffer mode you would have to remove  it or clear the buffer modes altogether and then at this notification buffer mode and change whatever parameters you wanted to close the ahead and take the notification buffer mode  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=96"&gt;Minute 16&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And will copy and pasted down here into the about promotes attribute and change a few parameters  and see how this works and the first thing we wanted to do is we want to  remove name equals notification because otherwise he would give us an era that it s already at  it so will remove the current one the default one and organa change some of the parameters  such quickly go through the attributes that are available in a buffer mode in this case notification  the first one is Max buffer size sets the maximum number of events that can be buffered  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=102"&gt;Minute 17&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Or so for example the regular flush interval attribute says he now flushed events from buffer at this regular interval and let s  make that five whereas we have also these two attributes which pertain to urgent flushed thresholds and what prices should say urgent flushes  of the buffer and what this means is that whenever the buffer size gets to this threshold it s considered urgent and then  the buffer must be flushed at the corresponding urgent flush interval lets say when every gets to five that would be considered an  urgent threshold and then we would flush the buffer every one minute guarantor of our compared to five in the regular interval in  the last that beauty is the number of says a nice luscious event maximum number of threads that can be used for the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=108"&gt;Minute 18&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Flushing process sets keep uppermost element which has is that essentially allows you to set up some parameters that buffer the health  monitoring events in memory and then controls windows are flushed out to the corresponding providers and this can help in performance in  the health monitoring system so the last thing that we need to look at is back up in the root element health  monitoring and in health monitoring door a couple attributes that you can sit here one important one is enabled and as it  applies this either turns on or turns off health monitoring symbol tarted on and the next act attribute we want to look  at is called heartbeat interval and this is a time interval in seconds so for example if we put a set of five here that would mean  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=114"&gt;Minute 19&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;That he was called the Web heartbeat event which is down here he is in line 3200 precinct on about the different types of built in  events and what this does not appear in this attribute is if we set this to five minutes for what happens every five minutes this Web  heartbeat event would be automatically fired by the health monitoring system and it contains are range of information about the current functioning of your ASP net  application so if you don t put this attribute in the health monitoring element within the heartbeat is not fired automatically at any predefined intervals if  you want it to be fired at giving an indication of what s going on in the overall application at a regular interval than you would  need to put this at the end one more quick last correction I realized is that the heartbeat interval is just in seconds I was thinking that it will  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=120"&gt;Minute 20&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;      &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=126"&gt;Minute 21&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;But I did is set up a rule called the heartbeat default it s back to the heartbeats event up above and a race to  the Windows event log and I set the profile equal to critical which can see down here is one of the default profiles and that  will essentially read out the event every time it s fired Swiss go ahead in sort of the website and we ll get our default  aspx page which is to settle just be a blank page now all that s running they are let me flip over to the event  log for the ash and will look at the application event log on me at the refresh button here and you see that were getting  these Web offense every 10 seconds that the application is running the last one years at 1345 and let me refresh you can now have another one years or  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=132"&gt;Minute 22&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Team 4559 and so on so these are showing up in our event log based upon the health monitoring system being configured and every flip back  over to Visual Studio lets shut down the webpage and it s very quickly review the different sections that we ve covered here in this video  first is we look at these as standard events that come with the health monitoring system of us that here in the web config file in  the sample code and then we looked at a event mapping essentially how you add an event in this case for adding and removing anyone a  standard events just to show you how it works then next we look at the different providers remember providers are classes that write out the event  information to the specific source and out of the box you have several length event log which we just saw with heartbeat and then you have a sequel  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=138"&gt;Minute 23&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;That UMI mail and trace providers next we had down your rules rules essentially connect the event to a specific provider  using a specified profile now we could have put the specific criteria in the rule puts profile abstracts that out and  down here we have altered the default profile and assisted other boxers to profiles the fault and critical and then the  last thing we look at is buffer mode switch control the offering of event information to help performance so this is  an extremely powerful system that allows you to configure all kinds of information to monitoring the health of a live application  and encourage you to download the sample source code take a look at it in more detail as well as refer to the MSDN  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_13&amp;&amp;bookmarkIndex=144"&gt;Minute 24&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Temptation to get a better idea  of the details of how you  can implement health monitoring for your  own system this is Chris Pelz  thanks for watching this video on  implementing health monitoring in an ASP net application  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/videos/video-195.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-8371781790952306466?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/8371781790952306466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=8371781790952306466' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/8371781790952306466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/8371781790952306466'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-how-do-i-implement-health.html' title='Video: How Do I: Implement Health Monitoring for an ASP.NET Application?'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-3810194457762738831</id><published>2008-08-31T19:59:00.003-07:00</published><updated>2008-08-31T19:59:21.733-07:00</updated><title type='text'>Video: How Do I: Create a Custom User Control in ASP.NET?</title><content type='html'>In this video Chris Pels will demonstrate how to create a custom user control in ASP.NET that can be used throughout a web site or across many web sites. Start out by learning the basics of creating a user control that will be used in multiple pages including validation, controlling formatting using style elements, and loading/saving data for the user interface elements. Throughout the video considerations for building user controls that can be easily maintained and used across multiple pages are discussed. &lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Hi my names Chris sells this video were to learn how to build a custom user control in ASP net get started let s  add a new website to her empty solution is to the regular ASP net website and cold website DB sore objective is to build  a custom user control that we can use anywhere in the website just like we can use a text box or a button control  that comes with ASP net and what I like to do which is by no means required is to create a folder called controls  and I put my user controls in that folder I should say I put user controls in this folder that are potentially used in  in various places across my website and a general user controls in another practice I do is let s say I have a folder called events and the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Ascendance folder contains webpages that relate to event based functionality if I have user controls that are specific to those event pages what  I do is create a child folder called controls and I put the user controls in that folder and the reason for doing  this is one it provides a nice organization so that the user controls related to events are contained within the events folder and  it also provides the flexibility to secure this controls folder should I need to do so to get started building our user control  we need to do is add a new item to our controls folder and it needs to be a Web user control template  item and we re going to call this address is going to do is to build and address basic user control that we can use throughout our website  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Now this creates an ASC ex file very similar to the ASP X Files you see there s nobody or form tag in here but  we do add any kind of HTML to the user control that we would add to a webpage it also see that it has a  control tag indicating it is a user control has the language specified much like a page as well as there is a code file behind  the user control in the same way that we have one for a webpage solicited started designing our user control and I ve start by  putting a given element which will be key in the outer master container for all the HTML that will put in our use control and  just to demonstrate a principle to put the word address here in one of the things is that you can t use a user control as the start  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Page so in order to see these control live on a webpage you need to put it on a webpage and what I tend to do is  to either create a temporary webpage to control or I put it on one of the pages that you will be used on in the live site  has some developing it so I can run that page and see what the control looks like and how it performs on a live site slips do  that seated within the door to default aspx and one easy way to put a user control the pages to go into the design mode and would  disconnect take the address user control and drag and drop it on the page and you can see we re getting the address text that I put  in my use control and now will run missing at sea that will be open if you are use control it even in its simple form here on a live webpage  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Are building our user control and we won t does have a layout with a couple launch the user to  enter their address city state postal code in country economies gives to do the formatting for a user control and  the first thing I want is a label for address line 1 label will put that inside this is 1  ns if and in that one would have put a text box where the user can enter the information for  address line 1 format this a little bit and unused classes to format are elements in a little bit and  just enough so we can have a nice readable format and its first monoclonal input element and then the second one we are  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;In a call input label and the third one local input data so  this is for address line 1 less use as a basis for our  other input elements where the edge of shrine to the city state postal  code and country hunches go back up and start putting some of the  IDs of us they will address one text will be addressed on an  Xbox to be address one as well now nanometer the rest of near  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;He had Xbox  and then we  ll follow that  up with state  and an Xbox  first aid postal code text box for  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Russell code and are less one will be for country and the  text box as a Saddam can control some of the formatting with  CSS styles close go ahead and create a theme for our website  and you call a default and inside the default theme we can  add a new stylesheet family in the coldest default screen and here  we need to put if you have classes that we created with input element  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And we had input label and read input data for input element let s just put  pay a little bit of a margin of five pixels on the top zero underwrite it  five on the bottom end zero on the left don t her label him as just  put a little bit of padding it was good to pixels so all the way around  and its copy that is the same thing for input data to back up your input  element in an all clear both of them use some floats here on our label and we want our  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Label to float left and we also want our data to float left hand with our label we also want the text  to align to the right for you and for the lets make sure government over your tour web config and specify the  theme and use it as the default save that plus check out how this looks and what I think you ll find  when creating a user control was specifying a theme in the CSS is that what you were going to design mode were  not seeing the exact layout and that s another reason for dropping music control over here in the page let s fire  up the fault they as to ask take a look and worked getting reasonably close to what we want for a layout on the page  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Lets you specify a a few properties of some of our text boxes because so will be longer than others and  will give us 50 columns for address and the max length let s say our database is 50 as well and  will do the same thing for address to hand the Max Planck and our city lets make that 35 columns but  a potential max length or 50 and the state is made to speak to columns have used the abbreviation for doing  in the max length is to now another alternative is we could put a drop down list in here that is  data bound to a table in our database that lists all the states would have a standardized list of states and the venues of primary key  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;To store the state value in our address is not something to consider renowned postal code and let s make this  10 columns to the max length of 10 and are doing is just as a US base address and country again  let s make that 25 columns but the max length will make 50 switches run the page and do it again  picture were getting what we want and indeed now it s much closer to what we won t buy would want  to align these labels and text boxes as well as extremely like in our user controls have done some standardized validation  s first delegation know we would like is to have the city be a required field take gay required field validator and we ll put that  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Out here to the right of the text box and will call that required validator  or city paying their message to hold the city is required in the text version  display in this case is the letter are now one can do is give this  a CSS class of validation message and Germany to specify the control to validate which  in this case is TXT city looks to school over to the CSS and Ed  are validation class held at two things one is the color once you read and we want the font  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Wait for people backdoor tour use controlled and if you check out our default aspects will see  that it is showing up grid in bold has we wanted it so drew back out and  add a few more validation controls let s say we also want the state to be required  just can copy and paste unamused for city music with state however you need to make a  few changes we want to have it validate the state said it will call it required validator  for state and Lucas changed us as to state is required to does do a few more validations and also  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=84"&gt;Minute 14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Required down here for the postal code make the necessary changes change the name  nor the idea should say in the control to validated as the postal code  militants change them as MLS validation were going to use is to put a  regular expression validator and we ll put that on the postal code syringe with  a table entry in the right format is called this regular expression validator or  postal code and will set the control to validate the postal code and set the CSS class of the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=90"&gt;Minute 15&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Litigation message that this was a postal two must be in the format and will put  the error text ads are an expression route and use one of the canned expressions that  we have here in ASP net for the US zip code and imagining a back to  text with something a little more in Florida that will save format must be now we  could put more complex validation here free wanted to but the key point is that whatever  they ll taste we put here in our addressees control will be applied consistently across the application or website where  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=96"&gt;Minute 16&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;User control is placed us just go back to our default page and what I d like to do is get a button so we  can post back to South validation and for the moment I will just put the button here on the page is through a quick test  before we leave the validation prep the webpage will just click a button to submit reduce see that we get our validation error messages indicating  a seal the required questions for three digits rather than required for meta postal code and we do get the format message whoever you saw  that its offset to the right is what we need to do is go back over to our address and we need to make this  display dynamic for the required are and that means that it will shift over to them for basically that the required validator doesn t take up any space  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=102"&gt;Minute 17&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Bus is invalid in other thing that we might want to the 30s control is the ultimate expose properties that could  be set by the container that using the control and let s say that we want to have an enabled property  for our use control much like over here on the default page for the button button has been enabled property now  by default in our user control will not have an enabled property so in order to add that all we need  to do is to put down into the code behind and we need to add a public property called enabled and  to set it and get it as a couple approaches and what we ll do is we ll created private variable called_enable  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=108"&gt;Minute 18&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Bouillon sweet to many here to our enabled property and  will say_enabled run another will return_enable hand down here will  set it you will need to do is to ask  the set the enabled property of far contained controls in  this case the text boxes to address one enabled value  passed in an address to value and we have city state  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=114"&gt;Minute 19&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Postal code and country and now we go back over to default SPX with user control is  located nor use it we can set the enabled property in one of two ways feel free  to link to the address tag for the user control will see there is now an enabled  property and we could set it here enable people s true or false we could also go  into the code behind and we could set the property programmatically here that s been downloaded that  simply go to address one which is the ID of the user control on the default page and there s enabled product  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=120"&gt;Minute 20&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Said that defaults and now if we start up the webpage and since we set it to false to see that I cannot get  access to any of our text boxes on a page so it s just get rid of that because we don t want down  around so we could go back over here for a code behind him he could at properties for other operations that or settings that  we want for our user control when the other issues meets the address news control like this is how do we set or get  the values of the address elements inside our user control and there s two approaches to that and one would be that we create  a property for each of those still in the go ahead and do that lets say for cities to see how that would work so okay a public  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=126"&gt;Minute 21&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Property city as a string and I just noticed that we should ve typed our enabled property here in  so we ll just do that to you as my Tafoya so when he gets a code of the  right code is in now what we want to do is we want to return the text from our  text box and will commit and then if we say we want to do the opposite said if the  value passed to the property so that we can create additional properties for the other fields such as the  State postal code etc no of this approach of creating properties for each of the UI elements in Saturday s  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=132"&gt;Minute 22&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Troll does provide a lot of flexibility so that whatever is containing this user control could individually set properties it also  doesn t provide as much about blackbox type approach where you control knows how to load its data is saved as  stated and may need to perform intermediary validations are conferred conversions of fields as it does so sue a second approach  and you can decide in and which is best for you you may need may use both is to create two  properties or if it s a two methods one that loads the data and one that saves the data lets create  the first one and we ll call it load data and will have it take the data lets say a data table is input  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=138"&gt;Minute 23&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Patent system data data table and his returns a Boolean whether or not it  was successful and then we might actually do a second method for function calls  to save data and this would also take a data table and return a  Boolean that many she s not that she would need to do what we  did up here with the city property and in the case of save data  we would need to take our to save the data to our data table that had perform any  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=144"&gt;Minute 24&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Validation and said they would be true with our low data is we would want to take the  values from the data table and put them into the July elements and everyone one of forget to  return either true or false to pay upon the success of loading or saving our information in one  point made here just to be clear that were not loading and saving the data to the database  and these two methods but simply transferring it from the user interface elements to some sort of sort  structure that would then be returned and it would be saved to the database as another part of the application  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=150"&gt;Minute 25&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;In our example by specified a data cable as the container in which we get data in and save data another alternative would be if  you have created an address class so that you have an address object you could pass in the address object and load the data from  it or save the data back into it and looking forward with net framework 3 51 we have the entity classes if you have an  address entity than you might pass bad in and you could use some the new features like the link data source to bind it to  the user interface elements in the right approach is really up to your situation what you feel my work best for your team no one  laughing like to do is may be somewhat obvious but I want to do it regardless just so everyone is clear on Islam and at a  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=156"&gt;Minute 26&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Us new page to the events folder called default aspx and then run to open a page up in the design mode and we can go  over to our address user control over their and drag and drop it onto this page and you can see we have all of the functionality  of our addressees control here on the default paging events folder which is identical to what we have in the default aspx in the root of  the website and this is an extremely powerful and useful approach to groups of user interface elements that are common across your website in fact almost  any time you have the same group of elements used in two or more places it may be worthwhile to consider creating a user control because  they not only is the look of the control standardized but all of the functionality such as saving and loading data into the user interface elements as  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_12&amp;&amp;bookmarkIndex=162"&gt;Minute 27&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;As well as the validation is similar and if you externalize the formatting abuse control to  a group of standard style class names to get a lot of flexibility controlling the look  of you use control from one place to the next so encourage you to download the  sample code take a look at a little more detail and can bet how you can  use it as a basis for creating user controls for use in your websites as as  Chris tells thanks for watching this video on how to create a custom user control in ASP net  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/videos/video-194.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-3810194457762738831?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/3810194457762738831/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=3810194457762738831' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/3810194457762738831'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/3810194457762738831'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-how-do-i-create-custom-user.html' title='Video: How Do I: Create a Custom User Control in ASP.NET?'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-4291850628675589129</id><published>2008-08-31T19:59:00.001-07:00</published><updated>2008-08-31T19:59:19.689-07:00</updated><title type='text'>Video: How Do I: Use Validation Controls in ASP.NET?</title><content type='html'>In this video learn how to use the validation controls available in ASP.NET to implement validation on your web pages. All the major validation controls such as RequiredFieldValidator and RegularExpressionValidator will be discussed. In addition, learn how to use the CustomValidator when one of the standard validators does not meet your need. Both server and client side validation options are shown. See how to do single validation on a UI control as well as multiple validations. &lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Why this is for spells in the city over to learn how to do validation in ASP net lets get started  by building a new website is called its website DB now I ve created some sample page layout for us do  validation on ahead of time sputnik get dad had a copy in paste that into our page and as you will  see this is just the layout of the page it s nothing to do with the validation is what we have  on the page are some typical user input controls and sell it at validation to them they get sorted list of  the validation controls are available in ASP net and tears several standard controls get a required field delegator arrange regular expression compare custom  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And a validation summary will go and teach those in more detail as the put them on the page and implement plus get started doing  some validation personalities controller with an edit page is called the validation summary put that down here below the login button in this control doesn  t actually do any validation for what it does provide it is a common place where you can display error messages from the other validation  controls that are located on your page in the open up the properties window on the right side because we ll be setting a number  of properties on these controls over to do with our validation summary is good and use this as a place where we can provide a  list to the user of all the fields on the page and have some sort of air that they need to go back and correct  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Type in a standard header here that ll be displayed with a summary control is that you must enter a valid  value in the following fields and what can he give this a CSS class I made up a small style sheet  inside of the page just to rub it in example of how you might use a style to make your messages  sent out a little bit and that s called validation message with the properties of the validation summary control that we  can leave in its default setting in which is bulleted list is called the display mode with the display code does  is allows you to format the multiple messages in your summary in different formats ballots had our first validation control to the pay  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;In the first one will add is called the required field validator and this goes as the name implies it requires that  the user enter a value in the field take this and let s require that the user enter a last name now  we have said several properties in order to have his validate the last name text box on her page first but I  would like to do is just putting the CSS classic and validation message and then it for important properties which control is  the required field validator associated with and in this case within a select the last name next will we need to do  is determine what we want for an error message and this is an important distinction here between error message and the text property  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;The error message property is the tax that s displayed down here in the validation summary control where is the text is displayed immediately  where is the validator is located on the page if the validation fails us were going to do in the air message is put  last name because remember in our summary control we have a bulleted list of all the fields that have something invalid so one last  name is not entered over going to get down here in the list his last name to the user as an indication after coup  appear to last name and in this case enters an information in them down there for text will work in a use is just  a capital are so there s a visual indicator to the right of the last name text box to the user if validation fails to  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Need to do something on last name is this only if you do to get a required field validator to work on the papal blessing for me to  start page and we ll take a quick look at this and actions to get perspective on how it worked for we do the rest of the validator  s fury of the page Hyatt will leave less than blank or click login you see we did both the less famously with our validation summary at the  bottom as well as the text value in this case capital are indicating to the user that they need to do something with last name let me just  put Smith and here and will click login again and this time you see validation passes we get neither the validation summary display nor the text for the  validator to the right of last day and all is gone and add some additional validation controls to the page to the next thing we do want to validate on our end  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Page is postal code will want to do is to make sure that the user has entered five characters that are  all digits nor do this were to be used the regular expression validator and is a very flexible powerful validator that  I found useful quite a number of places take regular expression control held it out to the right of postal code  like I required validator the first thing we need to do is indicate what control we want to validate the regular  expression validator and wanted to postal code and put our validation message class years we get to look that we want  next one down to the error message and remember this displays down a validation summary so we ll put postal code then hard to have  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;To display to the right of postal code text box is postal code must be five numeric digits next  we enter our validation expression and this is the regular expression which one evaluated to validate the contents of  control him to approach this one is there several predefined regular expressions that you can use or you can  type in a custom regular expression and we happen to have one for the US ZIP code so we  ll use that celery to test the postal code validation startup page and click login and we get are  required for less name but real expression is not a required validator is just checking the contents of a week to  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;A little getting eras of them typed anything in postal code Souljah states Smith and our last name and let s could ABC  and this should break the validation or make it invalid by that and indeed it does get the message that the postal code  must be five numeric digits we also see that the postal code is listed in the validation summary as one of the fields  that need to be corrected so now I ll just put 12345 log in again passes validation as we don t get either  our messages now let s do some validation on the phone number field and what we want to do for phone number is  actually perform to validation is one we wanted to be required in its second we want phone number to be in the correct format  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Validator survey shows you that you can actually perform multiple validations on a single control  on the page coder required field validator code validate and phone number class validation message  our message is phone is the invalid field in Texas we want to use in  its capital are in for a regular expression control to validate is also the own  setup or formatting and message we want displayed in the summary is that phone field  techs we want to display out to the right is fallen must be in a format  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Area code space prefix or suffix and now for the validation expression will see there is a US phone number but what we  re going to do exactly have a piece in a custom validation that I made up ahead of time for our phone number  is little bit different than the standard US phone number that we have here in the selection and also shows that he can  put in your own custom regular expression so that looks good in one of the things we also have to do here is  to count for spacing between the law are and this message from lesbian format because we could have text in here and to  NPR would not be displayed but it could be invalid so it s still get the second message and we don t want things jumping around  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;On the page and we do want to phone message to the way out to the right so what you can do  under acquired his Tuesday display property and it has two values which are static and dynamic and non we have a currently  static which means that we are or the text of our required field validator always takes up space on the page even  when it s not visible over to do is change that dynamic and now we ll watch is that the text of  our required validator will only take up space on the page when it s displayed so that will cause the second message  from our regular expression off to the right of it to be moved or shifted to the left when the car is not displayed  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Indicator for the phone call is less senseless for one last named Smith now let s only could three digits for the  phone which should cause the regular expression validator to fail in which it does seize phone still listed at the bottom is  having an invalid entry get our message here on what the proper format is so let s put that in and now  say this login or submit and both messages are gone because we fully pass validation for both required and rail or expression  aspects of the phone number field are let s move on to data birth date of birth we want to three different  validations so forceful put a required field validator and after that work for regular expression and the third one is going to be the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;In validator to acquire skillful business with them before us to set that up  or gave birth contents of the her name is date of birth for our  validation message in the box the bottom and the text will be PR and  we will make this dynamic salutes Bush is still left it it is valid  as a regular expression validator to set up some of the things that were  familiar with shoes gave birth validation message class your message will again be date of birth  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=84"&gt;Minute 14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And then draw a show that on the summary box and attacks will be lead us be in  the format of the month day day and for two of four digit year then far of validation  regular expression again when they do a custom one of us can paste in a big validation regular  expression to have on hand so a false lead with the Baylor expression in the third one is  the range validator which we have a look back at and the first two properties are common to  the other ones which control or want to validate and class in a message in a field day with his data for  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=90"&gt;Minute 15&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;In the and display them over going to say is that they must be between a  star with 1850 hopefully no one older than that and today and I ll show you  how we get today momentarily the next that we want to set are these minimum and  maximum values for the range validation and personal insight is the minimum and it goes to  format your Monday salute to 1850 1 1 and then the maximum value which we want  to be today delivered in a dissent that can go into the code behind an override download event for the page  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=96"&gt;Minute 16&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Magoo to the arranged validator or one concurrency and maximum value of innocent is equal to the static date Time object today  to two string him up and specify that it be here a month today so this will set the maximum value every  time the form is loaded to the current date and label them a property that we need to set and this is  the type of range that were evaluating its string by default and we wanted to pay to do the date validation and  the Kuwait when the patient take a look I remember there s one more properly need to set on the regular expression  need to make that a dynamic since we have three in a row here we want that to collapse to the left  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=102"&gt;Minute 17&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Well you know take a look in the page will enter less then no one sat  in the phone number and date of birth or to see that blank beginner required validator  and that s putting it invalid date formats or just go 33 and we get to  message is one that is in the wrong format and also that it s out of  range was so valid for men but one that s beyond today a subject message has  begun today go back and put it at 1849 still get the message let s change that 19  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=108"&gt;Minute 18&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;49 which would be a valid date and indeed it passes validation sets an example of using multiple validation  operators in fact three in a row each of the different type to get the result that we want  to make this to e mail will do to validations on e mail and the first one that will  do will be a required that down and will also do a regular expression acquired a house at the  normal properties fetch familiar with now contact class in the field nor the message name in a field is  e mail and the text that we want as our Are fantasy which is that the regular expression so  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=114"&gt;Minute 19&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Alumni make that correction and goes to the e mail felonies in this age group  could e mail and we will put the capital are some that looks good now  go back to the regular expression and all is not lost here because we do  want these two properties to be what we ve entered an era message is correct  text you want to is not a ballot to e mail format must be e  mail at post time for me to see these films validation wrong I notice that the red was not bold  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=120"&gt;Minute 20&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Is good and let s make sure we need to set the dynamic for the display type donated a regular expression  and there is one for Internet e mail address so take that it lets the start e mail click login to  be to get that it needs to be required to put an invalid e mail now we get the message not  a valid e mail is also listed in our validation summary must enter a valid e mail and we ll put  Jim that 10 4 and now the mail passes for validation the last two were good you are the password and  reenter your password both of these will have a required so that the required validator on both to set the properties tour to validate for the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=126"&gt;Minute 21&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;First one is the password in Qatar formatting our message is in the  password to ease the wrong deal and here we are again went down  on this one that s okay and will just change this to be  the re and her password hint of the text is capital are will  go up to the password and will control to validate his password class  message is password text is the capital are just go back and check my thoughts  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=132"&gt;Minute 22&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Want this to the password reenter a hand let s just said  both these the dynamic for the second validation we wanted when the  password will be a regular expression will take the regular expression that  on our password lengths set those properties password class K look message  for the validation summary listing the fields is password and then the  text is the password must include at least one of the following  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=138"&gt;Minute 23&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Viewpoint exclamation had found a dollar percent this is our plus and last but not least and  Colin validation expression and were going to use a custom page that in early on I will  check for a set sequence of characters within our password then we ll may reenter the password  we want to use was coldly compare validator who s who wanted to passwords to be the  same sort here will set to different properties won the control to compare and won the control  to validate it in a controlled compare it is password cult of validate is he password reenter  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=144"&gt;Minute 24&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Validation message in our air message and news re enter password list field that  has a validation era in the text box display is passwords do not match  please reenter Alex test out our password validation or approaches click login is to  get the two required for password and reenter the password is putting in Haiti  regular character password without formal special characters that are required with us but ABC  to log in and says it must include monies characters smell of a valid passport will just type password  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=150"&gt;Minute 25&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And will put a at the end of password and then we ll go down and we ll just type password without  click login as he would getting that at the validation or a pessimist to not match lets go put and the end  of the reenter click login and now the password validation is complete and the last television told him to look at his  the custom validator and as the name implies this is a free form validation tool where you have to supply all the  validation necessary as let s put this down on password and the need to change the display dynamic because fully decided to  do on password is we want to make sure that the user enters a password that said least eight characters long and the control to validate  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=156"&gt;Minute 26&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Use a password validation message in your message is password that is listed in the summary box the  bottom head in the text displayed to the right of the password is password must be aged characters  or greater now in a trainer validation logic and the first thing we do is write some server  side validation logic and double click on that television it adds an event handler to barcode and you  can see inbound there are two arguments won this source is the control that s causing the validation  on a good knowledge patrol and the second is the arguments which is a value that an Internet control  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=162"&gt;Minute 27&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;So we want to do is use the Argus Henderson is valid property and if he said  it is valid to true then your validation passes USA the password is valid if you are  the value in the arguments is greater than or equal to be an afternoon on the length  of back to the page and the other thing what can it do is some client side  validation and can see here is a property for the client validation function we need to add  that tour page and we will put that right up your header so will a script tag and language equal to  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=168"&gt;Minute 28&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Script and we want to write a function called his length  valid and we wanted to have tuned down arguments the source  and the arts and then will say Argus is valid is  equal to whether or not they are its value length greater  than equal to eight and will take that method named and  we will go back in to validation cooler to the client function  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=174"&gt;Minute 29&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;In and in the server and the reason for that is because if for some reason the client altered the client side JavaScript so  that they connect entering a character password it s still then go back to the server if that fails into our standard server side  validation cocaine as I set out separate page login passwords required let s type TASS and so we have our special character but the  total length of the password is less than a login and now get the client side validation lets get rid of the try login  again this time it posted back and we got both the password needs that the special character and the length is equal to 80  smell a center the rest of the valid password and you can see our pass for now has passed all three of its validation  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=180"&gt;Minute 30&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Of us may want to point out is that in any validation control you have a property called to enable client script set to  true by default and what this is is that if the browser supports JavaScript then the validation that s been specified is done on  the client by default since summary we looked at the different validation controls that come with ASP net and then we looked at how  to use them in different combinations some of them are used alone such as with last name we just had a required field validator  resume date of birth we had three different validation controls required field regular expression and the range validator we also looked at how to  do custom validation pesticide out here with the password length validation that also had any client side validation occurred you to download the samples  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_11&amp;&amp;bookmarkIndex=186"&gt;Minute 31&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Was code that comes  with this video take  located more detail this  Chris Pelz thanks for  watching this video on  validation in ASP net  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/videos/video-193.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-4291850628675589129?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/4291850628675589129/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=4291850628675589129' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/4291850628675589129'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/4291850628675589129'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-how-do-i-use-validation-controls.html' title='Video: How Do I: Use Validation Controls in ASP.NET?'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-5082832260104362298</id><published>2008-08-25T23:01:00.005-07:00</published><updated>2008-08-25T23:01:09.809-07:00</updated><title type='text'>Video: How Do I: Implement Site Navigation in ASP.NET?</title><content type='html'>In this video we learn how to define a sitemap and use it with the Menu, TreeView, and Sitemap server controls. We see how to use a sitemap on a master page for site-wide menus and how we can have single or multiple sitemaps on a page. In addition, we are shown how to integrate a sitemap with ASP.NET roles by using “security trimming” to dynamically show or hide menu options for users with different access levels. &lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;At website through a will call this website ASP net has a very nice feature is  for implementing site navigation to the main ones are what one is called a site map  file which is a central location that contains the logical layout of your site and the  second is a number of ASP net controls allow you to visually portray the site navigation  in several formats the first organ into here in a website is to a eighth site  map file in the default name web site map now the site map extension is important here because he got  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;net framework will inherently secure the file with a annexation of site map so that you want  to use that she can see here the segment file is actually an XML file with a  RTO representation of your site navigation Switzer to fill this out a little bit and make the  top level element called home and then under that will put customers and do it well will  put orders and will add one more call to battle the local peer to customers and let  s had some children are and for phone will say it at a customer and edit a customer  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;As well as inactivate a customer with a take through  these handle down under our orders no pace had aimed  hand will say that in order headed in order and  last one underwater will say change order status and will  put down into the about it here who will say  and get help on as well as report a bug  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Homages format this a little bit to get it nice and neat and you can see keeping an  XML file it provides a nice visual representation of the hierarchy and layout of your site to concede  that we have filled in the title attribute of each site map node and the title is what  you ll see on say a menu so that s what that is and description is what would  come up on the tool tip a few of these in and say this is our site down  under customers at all about customers and will just had a new customer for the company at eight existing  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Customer information and so on we continue on into that for all the rest of our notes that the URL attribute here he  is the name and location of the page that will be used for navigation of the node and there s one important thing  here is that you can t have two nodes with the same URL is just create a little hierarchy here in our site  and what I m going to do is to static couple folders when called customers on cold waters and one called about now  this isn t a requirement but it s a nice way to organize your pages to parallel the hierarchy of your site and  this ll come into play you ll see in a little bit only talk about integrating security with this site map or the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Negation of the site so let s just have default is the ex  was just in a few pages in here so you can see out  some of the linking works and the first one will just call at  a customer second one will add it here he is at customer and  under orders little to Gwinnett orders as well as edit orders and under  orders will pull one call to change status and walls to change the status of here  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Herb out of Louisville get health as well as report about the is now let  s go back to our site map file will close out all those other files  that start to do some of these URLs in here and the first one is  default aspx and the second one will be what we we have customers honesty we  have to add a few more pages here so let s just quickly do that  will call this defaults and muscles to put a default in the orders so back tour website map  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And that was because first got to fault and  the Cisco appear and use the little squiggly simple  so that looks correct their foot down here to  put them at customer to noun here to edit  customer here to change status orders for the same  thing default aspx and then we ll head orders  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Had a daughter and a change status is down  to about 10 and get help in here and  we also have to put report bugs hinted last  not least will put this as default and the  vocal over here and had a default page into  the about folder tonight and see if we have  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Did all of the pages that correspond for a site map so we ll get URLs and pages to link to only implement  the site navigation smelling of the logical structure of the site in a site map file list as some ASP controls to the  pages so we can use that data for site navigation down you can put these controls on individual pages but woman to do  is a good practice from the crater master page will put the navigation controls in the Master page so that then they ll  be available on all pages throughout our site to appear and add a new item handball at a Master page lets just call  this default master for me and a couple kids on the page here for some of the areas that will happen the first one  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Call header and then underneath the header is a menu to and I think that if  you put it will call a frayed crumbs did and then under that will put content  to have noticed the debt the ASP content placeholder insider that limit is reformat this is  a nice look at it and this can end a cascading stylesheets with little formatting fran  ais one of these navigation controls and I will add a new theme default and it  didn t seem amid a cascading style sheet also called default and paste in some styles of data previously  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And it looks good tell us the back over to our master page and Sergey had a few elements in here  are other controls I should say and what we want to add the first thing is over here it s called  a site map data source and this is similar to the SQL data source object data source etc and it s  designed to work specifically with site maps so we ll take that you put that up here thousands for using a  standard web site map file you don t have to specify anything else to set up our say that data source  by default it automatically will use that file so now scoot down here and what we want them in the first is our menu so  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Over here to navigation navigation tab and considered several options here you take a menu control and putting them here in our menu did  was given to the toolbox and Ellis look at how we set up this menu control teaser site map suppressing its due to enable  our menu with the site map score here and meet us at the data source IP and will set that equal to the ID  of the site map data source to see is the default name that is government control attached to our data source at start up  the default page and see what we have at this point and we do have some navigation here in place with the menu and  as you can see you get different menu choices and we can navigate any one of the pages they are cool tips showing up so good at customer  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Peer in the address bar you could see Ronnie at customer page and here were back on the default aspx page else  go back and format this manual little bit to look more like what we might want on our site will close down  the browser window and in our master page is filled into the design mode hook to our menu control and less auto  formatted disk is a slightly different look here by applying that format to it I will set a property or to soak  over the properties window and one things I want to set initially as you orientation is currently on vertical said that two  horizontal analysts start up the webpage can and see what we have at this point can we have a color scheme here is there is a  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=84"&gt;Minute 14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;They still looks like we have this vertical menu and select see why that is the case zealot okay but the problem is that we  only have the home menu option showing which is the root we don t have customers and orders which is really what we d like  here as well so to do that we need to good down here in what s called the static display levels and Renault are only  showing one level so we re getting just that top level which is home to exchange this kid to and now we should get the  additional choices here in a while rather is to make a quick into autoformatting generally like the way that was so changed the classical smell  that started up and here s our page and we should see a horizontal menu which we do and it has all of our choices on it so this  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=90"&gt;Minute 15&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Is much more the way that we would like this layout on our page and its menu bar across the top the menu looks in good shape  now let s move on to what s called the site map path so switch back to the source you are master page and won t want  to nexus of cities use what s called a site map path control and you might know this by the name breadcrumbs as well plates in his  prime many times on a site where it shows you come about a list of the links that correspond to pages that you visited as you navigate  down into the site for Gore to a toolbar back to the navigation section and in their Thursday site map path control take one of those and  put it inside our breadcrumbs to an arson at path is automatically connected to our site map data source which we ve already added to the page for me to  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=96"&gt;Minute 16&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Over to the design view and do a quick autoformat hotness take colorful and now let s fire up the page and you can see with  very little effort we now have far way comes here it records say to edit customer their children at a customer with a link for customers  and also won one customers which go back to home page news as we move through the pages such as edit customer that were keeping the  menu and the site map because we re using Master pages so so effort where it will have a nice set of breadcrumbs here on everyone  or pages which improves our navigation capabilities for the user now let s want take a quick look at how you can they used the tree  view control with the site map data source as well so they can also use the Treeview control of financial asset net data source to display navigation unit  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=102"&gt;Minute 17&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Format other than put this in the Master page where it would show up on every page let s  say we had one page he had customer page where we wanted to have that preview navigation to go  in here to the toolbox that navigation take preview but that here on Arquette customer page they also need  to connect it to the data source on the master page so it s a data source ID that  data source one cell startup website and on our homepage no Treeview because it s only on the edit  customer page A customer to assert to do with the regular navigation capabilities equal to what we have appear in the menu so  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=108"&gt;Minute 18&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Pick at or over the head orders page back to home and customers to show that to you again says a third control that  works with the site map data source etc to look at is heading security tour site map or we want to restrict access to  certain pages in the site based upon the user s role don t do this we need ASP net membership in salt so I  ve gone ahead and done that pretty SQL Server database called site navigation and I install the appropriate ASP net membership objects in a  database by running the ASP net_read SQL utility also went over the web config and I added the sections for the membership provider and  the role provider so that I say we have to do is have a login page is still greater folder for that caller authentication and  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=114"&gt;Minute 19&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Edit page and Colts paid to blog and not our login page you want to put a login control forget that  the toolbar puts it on a login page and then also on the home page put a login status control and  I will show whether or not we re login logout and allow us to log in our logout based on what  current setting is it that no are ready to let our security more getting used is called security trimming essentially what  that does is it will trend specific nodes out of our site map tastes upon the role of the current user  and then the settings at work and it do in just a moment that indicate what roles get access to what nodes are  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=120"&gt;Minute 20&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;I ve not going to do several things to set that up in the first thing  we didn t do is to enable site map trimming by going over Torah web config  and add a new section down here to add a section of type site map when  you specify the default or of either as XML site map provider and visit the enable  out few equals true they were going to add a provider in the provider s element  that the name of our providers can be XML site map provider switching equal to default site map provider  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=126"&gt;Minute 21&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And need in his be cool to system Web and XML  say that provider and indeed the site map file is going  to be equal to Web site map and then the security  trimming enabled will set to true that will enable the security  trimming on our site map so I returned on security trimming  the citizen access rules in this couple where you can do that  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=132"&gt;Minute 22&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Over to you first is we want to restrict this customer folders here and allow only users in a number  role to be able to view the customer menu options do that where you can go up and running ASP  net configuration page and it here as invention I set up a tasty dead end membership and what I ve  done is created to users on hold administrator the other called member and I ve assigned some roles to them  for the administrator I put in the administrator role as well as the number role and then for the member  they re not an administrator but are a member role now all we need to do is to create some access rules for our site  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=138"&gt;Minute 23&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;There is to define access rules for any of the folders in our website by default everyone has access to the site s  will we want to do is then restrict access for certain sections and as I said what we want to do is take  customers folder and apply a couple restriction rules you missed two things to keep in mind when you create to rules and they  re mentioned herein in the text at the top of this wizard page 1 is that the rules are applied in the order  in which they are listed and that also they ve been applied to all the subfolders so you have to think carefully how  you apply these tools spoken into for the customers folder is the first fool is were going to say members are allowed access to this setup that rule  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=144"&gt;Minute 24&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Then let me go back here the wrong button here we are in customers of our first rule is to allow members and  then because we don t want anyone else in the folder we have dead yet a second rule and say will deny all  users access to the customers folder sources said this reads from top down in sequence and what happens in the processing of security  training is it reads from the top down and as soon as it finds a match it then enforces that rule so it  s very important in this case that we put the allow members first and then deny all users second because one will do  after were logged in as a member is in or read the first rule allow us in and we ll never get to the second rule if  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=150"&gt;Minute 25&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Were to put the deny all users as the first rule we would never getting to the customers folder smell go back to her  website lets the sub is will we put in place to start up the homepage as we can see the customers menu option is  no longer available because we are right now in anonymous user we haven t logged in however what use are a little login link  here and let s log in to the member user which is in the member role is now only logged in as a member  we do have a customer menu options available to us so how were these access will supplied well what happens is there s a  web config file added to the folder and there are some rule elements in actual gore for customers folder are fresh in and see that a web  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=156"&gt;Minute 26&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Config file was headed if you see that there s an authorization element added with a one to  many allow and deny child elements is also possible to have multiple site map files and attach them  to different navigational controls was aired a second site map here to speed things up will do is  use copy and paste our web site map that will remain at coldness and special bus site map  OpenNet out in this one going to do is just to have the about choices and that what  we need to do is go back into our web config file down to the site map section saw a little bottle  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=162"&gt;Minute 27&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Oligo and we need to a second site map provider will call this a special site map  provider in the description and use the same type XML site map provider or want to do  is point to the special site map file and leave security trimming and able to now let  s use the special segment provider over here in the ad customer page will will do is  add a new site map data source to this page rather than using a site map data  source one for the Master page and we will hold a site that swears to point the tribute to that site  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=168"&gt;Minute 28&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Data source and will head the site map provider attribute and will point to the special site that provider which  is defined in the web config file that will start up the website and we have to log in as  administrator is to have security trimmings set for that log in to your customers will go to the edge customer  page and I can see that the Treeview is using our special site that provider because we purchased the about  choices and that such a way to mix and match site map providers and multiple site map files attached to  different navigational controls in summary we looked at how to create a site map file with various site map nodes in  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_10&amp;&amp;bookmarkIndex=174"&gt;Minute 29&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And then we look at how to attach that site map file to do for navigational controls including  the menu control a site map path control and the Treeview control using a site map data source  and then look at security whereby you can use security trimming to limit access to different nodes in  your site map depending on what roles the authenticated users are in and we also looked at how  to use multiple site map files and attach the different site map files to different navigational controls hope  you enjoyed this video on site maps and navigation in ASP net this is Chris Bell s thanks for watching the video  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/videos/video-192.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-5082832260104362298?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/5082832260104362298/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=5082832260104362298' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/5082832260104362298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/5082832260104362298'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-how-do-i-implement-site.html' title='Video: How Do I: Implement Site Navigation in ASP.NET?'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-2315640529215620279</id><published>2008-08-25T23:01:00.003-07:00</published><updated>2008-08-25T23:01:06.472-07:00</updated><title type='text'>Video: How Do I: Create a Custom Profile Provider?</title><content type='html'>In this video we learn how to create a custom profile provider to store and retrieve data associated with a user profile in SQL Server tables separate from the standard ASP.NET membership provider’s aspnet_Profile table. The principles covered in this video will apply to creating profile providers for other databases like Access and Oracle. After learning how to create the custom profile provider we learn how to install the provider in a web site and see a demonstration of loading and saving profile data. &lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;High this dispels this video you learn how to build a custom profile provider for ASP net may times the standard profile provider that comes with  ASP net membership is sufficient for your needs but then again there may be times we like to create custom profile provider either to store your  profile data in a different kind of database or you may still want a stored in SQL Server which is what the standard membership provider does  it rather than the regular profile table he is like creates their own tables to store the profile data and more granular manner so you can  do reporting or other things suffragan and do here first thing we need to do is to create a class library project that will contain the  logic for a custom profile provider lets go up your torrent the solution at a new project lead a class library type project and let s call this  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Profile provider sample and let s just stored in this folder here and we  made a couple references in our class library project some other assemblies focused view  all files so you can see the references are retreating here and add references  to two different assemblies first one will be system configuration and the other one  will be system Web now in order to create custom profile provider we need  to inherit from the class called profile provider lets take our class here and Harry from system  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Arrow system Web profile profile provider known hit the entity year would you get a seat use all of the abstract classes that we need  to implement for our custom profile provider finish can see there is a fair number of them here that we have to implement some interest  of time because they have quite a bit to react cover on this topic permitted to use bring in a class here that I ve  created ahead of time which has all the code for these methods and I will go through and review what the code does and in  each of the methods over here and just refresh our project there is a class that will bring in to include that in the project  and now let s open up and take a look at it swimming time here in our classes I ve called it each day I profile  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Provider put it in its own namespace as you see it still inherits from the system went profile profile provider class which required to do and  then I dated a few imports up here so that don t have the type fully qualified namespace is in a number of different places so  look back over here to SQL Server what I ve done is just create a database in SQL Server ATI profile provider and I ve installed  ASP net membership in your membership tables were interested in are these two tables down at the bottom that it created what is called profiles and  the others called profile data now profiles has a number of columns in it they don t have to have these column names literally but you  do need to have columns that store a unique identifier a username and application name whether or not the user is anonymous as well as the date of the last activity  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Because the implementation of the profile provider class requires that you be  able to store that data into certain operations that relate to that  date is a pretty standard set of columns in the other table  we have here is called profile data and this is the table  in which I ll store the specific profile data that I want  for my particular application in this case at a unique identifier for each row of profile data  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Al and store them locally most notably appearing class variables are connection string and application name now let s take a look at the  get properties and set property value methods and these two methods as the names imply he get the values for our profile or set  the values for profile closely look at how we get the values for profile for getting down to this method is the application context  as well as a collection of properties that we can set so essentially what we have to do here in our method is go  off and get the values for each of the properties in this case from the profile data table and store than in a collection  of values corresponding to those properties are presently in a two year starting of I 95 is far to interact with some of the use information from the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Patient contacts so here what one do is find out airlines store the username and whether or not the user is authenticated because  within a need to store that in some of our tables and their metadata but in a setup a sore procedure over in  SQL Server that when a call to select the profile data from the database and add a few parameters down here starting on  line 103 we were passing in the username application name and whether or not the user is anonymous because those are the three  criteria that allow us to uniquely identify a profile for user in the profiles table and Tonya l seven were initializing a new  instance of the settings property value collection which you can see a Carolina 93 is the return argument from this required from this method and remanded out here  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Darr try block and within a open the connection as you do SQL data reader from ago to loop through each  of the properties that were sent in down to this method and for each one of those within established what the  property is by looking at the names are property in this case you receive TNT s LAT and long and if  we find that property their market to take the value from the SQL data reader and assign it to the property  value and notice we re creating a new instance of a local variable for the settings property value class which is  where we re storing the property value and then down here on line 131 as we iterate through each of the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Here but to help you essentially what s happening is this one click should come in down to a method which has all the properties and then  there s a separate collection that s been returned from the method and in debt collection we have each of the values for the property sunroom world  done down here you see we are returning the collection of values that we have created sluts claps up this get properties method for slowdown and look  at how we would set properties and what s happening here is essentially the reverse of what we just saw in that property values are getting in  down to this method application context in essentially the same collection that we returned from the get property values method up here is being passed back to  us and what we need to do then is to take each of the values in this collection and store them back in the database doodad we get some of this  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Information than we did when we retrieve the property values that username but are not authenticated we set up a stored procedure here at work a  call to save the data get some parameters which allow us to uniquely identify the user for saving the data and then we iterate through each  of the inbound property values settings and we add that value to a parameter passed the inbound to the stored procedure and mom are done with  the setting up parameters which is opening the connection and executing the query to save the data in the database okay let s look back over  your SQL Server here are the two tables the profile data and eight profiles that we saw a little bit ago but down here to the  stored procedures any of these procedures that have yet to get_prefix are with the membership provider but down here here are the various stored procedures that were  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Using for our custom profile provider after getting our property values for our profile were using the profile data select and that  stored procedure passes in three batters which allow us uniquely identifies the profile and before returning the data so we can stored  in the profile in our code here online 21 is calling a separate stored procedure which is updating the last activity column  in our profile record which visual call is up here right here at less activity in the service you did ever using  to set the property values is profile data update something to look at that in this procedure for getting the three piece  of information to uniquely identify the profile was as well as the profile data values here so we do in the stored procedure  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Is we tried to find a profile idea based upon the username application name and whether not synonymous if we don t get a  profile idea we assume this is a new profile so we ask you to separate stored procedure profiles in certain which creates a new  profile and then we go down here and if it is a new profile we insert are three values into the profile data table  with unique identifier or for other foreign key back to the profile if it s an existing record or profile then we update the  three values in a profile data table and then once again we execute a stored procedure which updates the at last activity column in  the profiles table another is the abstract methods to react to implement beyond the get and set property values will have to do with operations on groups of profiles  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Temple down here on line 195 he can see is a method where we are to delete any inactive profiles and that s  based upon a primer which is specified date so what this method would do is go out the gold of profiles last activity  date and that s why it s important we update that value each timely access profile and he would delete all of those  profiles that have not been active from the specified date began as a method after that we choose to lead all the profiles  based on an array of usernames so essentially here s a bunch of usernames to legal profiles and then have a companion method  here where we passed in a collection of profiles and we say okay to legal these profiles based upon the usernames better in the collection  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And a series of methods that have to do with retrieving profiles first one here on line 298 is to find all the inactive  profiles based on a user name to match so we pass in the username the activity date and then hear authentication option is passing  in whether or not we re doing was an anonymous warn authenticate a user to take all of this information in down to the  method and it looks up in the database Faisal was profiles and returns a collection of those profiles that we have some other methods  here for finding profiles the next one is to find profiles by username and essentially the key in down right thing here is the  username to match and I should mention that this can be not a fully qualified username but it could be a couple character like  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=84"&gt;Minute 14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Essay tea or something like that new final abuses that start with SAT and return the next we  have that I get all a inactive profiles based simply on an inactivity date as compared to the  previous method up here which was in activity date and the username we have get all profiles based  on just in this case the authentication option page index and page size and then we have a  method here he gets us the number of inactive profiles based on AP and the authentication option alerts  on here to simplify that code for us is that each of these methods actually calls another method  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=90"&gt;Minute 15&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Eyeing another private method here in our class which passes in the various arguments in this case we don t have some arguments so two of  these inbound arguments are set to nothing and will score down to our methods region and in here we have two methods check parameters is just  a little utility method that looks at the page indexing page size just calculates some information for that we will take a look at them in  any detail has been a method of our look at get profile and post let s expand that and this receives number of arguments in down  as they saw up in the methods above and it returns a collection of profiles essentially what this method is doing is taken using the arguments  setting up a call to the stored procedure pack that passes all of those arguments in a stored procedure is doing the majority work by then filled  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=96"&gt;Minute 16&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Ring and retrieving the appropriate profile records that we want and then down in this method for creating a profile for each return record and putting  it into the collection is the world on with creating our custom Lighter now let s create a website and tested out as an mentioned in  the beginning of the video we need to have a ASP net membership insult in order to test out and use the profile providers want done  is to create a website ahead of time that has the ASP net membership install them will build upon that test that are profile provider good  or solution and that existing website to our solution is right there and you notice the website he has a database in HDI profile provider and  that s the database and we ve been looking at when we are pretty our custom profile provider over here in this class library project also on the web that can  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=102"&gt;Minute 17&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Begin here weren t set up the membership provider of related elements to the first thing we need to do is install our provider here  in our website in order to do that we need two things one is we need a reference to our assembly that has the provider  and let s add that here and in this case what I m going to do is just reference the projects in our solution you  could also create a bin folder and add the assembly manually into the bin folder to suddenly we want to do is have some information  to install our provider in the web config so we re down here to where we want to put that and what we want as  a profile element and we want to specify the default profile provider and recall that UTI SQL provider and then we want to add a provider in the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=108"&gt;Minute 18&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Providers element in the main delighted his face  HDI SQL provider in the type is the  fully qualified name for assembly and that would  be profile provider sample provider in Leslie HDI  profile providers in class and then the connection  string we want to use that is the HD  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=114"&gt;Minute 19&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Guy connection string which I set up and up above them is now  also being used by the membership provider should might see up there on  line 68 and the last thing is the application in who call this  HCI videos then we have to set up the properties that are provider  uses it as a want ad and their old one for the first  one in name is GMT and the type used a system int 32 in the allow anonymous  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=120"&gt;Minute 20&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;When set to true then the next one to say and the  next one that we want to add is called Latin and the  type of this is system single and we also want to allow  anonymous and the third and last one is a long type is  also system single and allow anonymous said it would pay for these  operations on our profiles at a new webpage here and we ll just take the default aspx  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=126"&gt;Minute 21&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;In the first he wanted to on this page is for had a long and status control let s  get one of those bring it over here and will put them right in here that we want to  add a couple text boxes where we can either view or edit some of the profile information so let  s bring in a text box here and ago to Xbox for net in put that in there and  let s just given a label in this case were to call this username for the first one hospitals  based in their talent and a copy that has them in 21 to three more was little editing here is  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=132"&gt;Minute 22&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Of the GMT as funds can have the latitude to him  and his phones can have a launch to just remain the  text boxes to TXT username 16 GMT latitude and longitude and  let s go down here and and another a little paragraph  and hear what one of put is couple buttons so let  s just create ASP moves the TT by Mary Gero and this is  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=138"&gt;Minute 23&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;This one button clearer than an equal server in tax than this one  will be clear in its copy that is known for two more buttons  and we go talk in a city in the site ones can be  called by the load and a third one and less funds in cold  blood and say text here to move profile and save profile post over  here to our code behind and the person we want to do is override the unloaded and  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=144"&gt;Minute 24&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;is and what we wanted to hear it is take the profile object and  we want to test to see if it is anonymous and if it is  I just remembered we want about one more thing over here in our page  editor at appear above the username last to said a label he then led  an ASP label here in IT rules on a run at equal server there  we go now and go back over your article bind and what we want to do here is  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=150"&gt;Minute 25&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;That label things that tax for a label if we are anonymous when you  put DES and then if are not anonymous to put no end when you  take the username text box and we re going to assign the username from  the profile to that conveyed us go back over your tour page will just  go into the design mode and we want to set up an event handler  for the click event for each one of these buttons and in a clear cynical take the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=156"&gt;Minute 26&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Xbox has said that equal to string empty to imitate  the latitude and head said that to string empty and  the same thing with the longitude there were no down  here too are lured and you take the profile handling  add GMT text box are considered equal to AT T  value from the profile same of the latitude and longitude and the longitude  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=162"&gt;Minute 27&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And and I say we do there are some who were again taken  profile and were going to take the GN tea and value or property  in the profile and it ll assigned the GMT textile UN is entertained  for the latitude and the launch of them that unless they wouldn t  do here he is at a simple login page showed lets you set  a new eye near and a cold page login go here toward cool  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=168"&gt;Minute 28&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Ox alien to get a login control news him of input data right here on this page dismembered one little mistake  over here in our code behind me a tad indexes to tax us is correct that ultimately that would input peace  call the save method over here in our state click event so let s put that in here somewhere saving the  profile afterward on occasion be all set to test out our simple website here in our profile provider that started up  without debugging and we initially are not logged in sober and anonymous user were given as good as our username lets  put in some values here let s put one disc two and three quite quickly and then this button will save the profile backed  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=174"&gt;Minute 29&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Database lets just do that here would clear out the profile information will keep the same usernames who only clicked low profile it  should load in that information back again as it does now let s login and I set up one user in the database  already in the membership provider called test user password Which output in the readme file a login our login as that user will  be loads of profile here we should get the profile information that was previously stored in the database when I created his user  and we do it s also one to three so let s just prove that this really works here by changing these values  will save the profile watching logout go back to the anonymous user logo they are profiled still there will go back to login as the test user  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=180"&gt;Minute 30&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And now or back as votes overall pass through the thread again there is test user let s load their profile and derelict  I used that we just enter for saving our profile information here by invoking these buttons you could use other means to save  the profile data whenever you wanted to and it s important to note here that we have set this up supports leaving both  the profile for anonymous users that visit the site as well as authenticated users just to finish up this lets them go over  to that SQL Server database here and I ve opened up the profiles the profile data tables here is our test user that  was there before we started let s refresh this and now we ll see are anonymous user is seen here as well lets over the profile data  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=186"&gt;Minute 31&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And we have here the old profile data will reexecute that then there is the profile data for both are anonymous and our test user  so in summary to create a custom profile provider be created a class library project profile provider sample in it we have one class that  inherited from the required base class of profile provider within its men s logic fully required abstract methods from the base class once we re  done with her provider he created a simple websites tested out of here installed the provider by adding some elements to the web config file  and then created a simple interface for testing a loading and saving of the profile information is quite a bit of information in this video  on how to create a custom profile provider so I encourage you to download the sample source code and look at it in detail this is crisp  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_9&amp;&amp;bookmarkIndex=192"&gt;Minute 32&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Pulls thanks for  taking the time  to watch this  video on how  to create a  custom profile provider  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/videos/video-190.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-2315640529215620279?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/2315640529215620279/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=2315640529215620279' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/2315640529215620279'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/2315640529215620279'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-how-do-i-create-custom-profile.html' title='Video: How Do I: Create a Custom Profile Provider?'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-3511638381021133656</id><published>2008-08-25T23:01:00.001-07:00</published><updated>2008-08-25T23:01:03.595-07:00</updated><title type='text'>Video: How Do I: Create a Custom Membership Provider?</title><content type='html'>A Membership Provider allows a web application to store and retrieve membership data for a user, and the standard ASP.NET Membership Provider uses pre-defined SQL Server tables. In this video we learn how to create a custom membership provider that uses custom SQL Server tables separate from the pre-defined tables used by the standard provider. The principles covered in the video will apply to creating custom membership providers using other databases such as Access or Oracle. After learning to create the custom membership provider, we learn how to configure the provider in a web application, and see a demonstration of creating a new user and authenticating the new user with the custom membership provider. &lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;I is for spells in the city over to learn how to  create a custom ASP net membership provider to implement a custom membership  provider of all we need to do is create a class that  inherits from a base membership provider class that implements a number of  abstract properties and methods that are required by the base class was  going pretty class library project here will call this membership provider of VB  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;To actually in the first one is system configuration and the second one will be system Web now they have those references  the next thing we need to do it is take our class one here and inherit from the base class had mentioned  that has the abstract properties and methods that is to insist system Web security membership provider and let s hit the enter  key here will see these stubs for all the methods that we need to implement and I can see from the list  of methods here in the drop down his quite a few methods and properties that we need to implement so in the  interest of time what it can do is bring in a class that I ve already implemented all these properties and methods  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Doughnuts spend a ton of time looking at the development of the code but can focus more on what these methods do and how they  re implemented Cisco out here and we ll take the project and let s refresh it and here s the class I want to bring  in cold HDI membership provider to include that in the project and will also delete class one here this front and a need that anymore  for to look at the invitation of the methods for the membership provider base class we need to create a place to store our membership  data that we were using a SQL membership provider that comes with ASP net there s a script that creates a variety of tables and  stored procedures for the membership data for a since for creating a custom provider here will want to do is have our own place to store membership data celeb  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Go to SQL Server and take a look at how would I do that this cable here in cold users which will be used  to store our membership data and there s a variety of columns that are contained in any most of these columns coincide with the  need to store certain pieces of information to implement the functionality required by the methods in our base class and will refer back to  these columns as we go through the code and look at the implementation of some of that functionality and we hadn t be using  SQL Server and the sample but you could easily use another database a Microsoft access Oracle etc to store your data cells go back  over to Visual Studio and take a look at the implementation of our membership provider class solicited with the implementation of our custom membership provider  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Efficiency indeed share membership provider inherits from the base number two provider class which is required for any custom membership provider could have  done here is to group Freya sections of the class into regions so it makes a little easier for us to take a  look at things given that there is a just over 1200 lines of code in the class is number of import statements up  top just made easier so we don t have to type the fully qualified name spaces as number of classwide variables here that  are used at various points of the functionality in the methods of the class and we have our first override here of the  application name property from the abstract base class and all this is doing is storing and retrieving the name of the application in one of those  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;As wide variables that we just saw above that we have several other properties here there are also implementing overrides of  the abstract base class we have one for the eight leading of resetting the password one for whether or not the  password can be retrieved whether or not the provider requires that a question and answer be part of the registration or  create user process whether or not there is a unique e mail required in the Mercer process the number of or  rather the maximum number of invalid password attempts that the user can make when logging in as well as the window  of time in minutes in this case that we found invalid password attempts also there is one for what format we use for the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Password and see that a little more detail in a minute whether or not we require a minimum number of  non alphabet for alphanumeric characters and also what the required minimum required length of the password is and then lastly  what the strength regular expression is noticed you who have worked with the SQL membership provider that comes with ASP  net a number of these properties should be familiar to you as they are attributes that being said in the  web config file when you specify the membership provider and what I see when we put this custom membership provider  into a website testing you ll see that some of these will be set as attributes of our membership provider in the web config file  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Method and essentially what happens here in the initialize method is that we re retrieving a  number of values from the web config file so for example let s take line 172  here and what s happening here is that we re going out to the Web config  file were getting Vmax invalid password attempts at you and restoring that in a classified variable  of the same name I ve done here in this class is to try to be  consistent in the naming convention so you ll see many of the class library bowls are named such that they correspond  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Flight rival password format to the corresponding standard he known value for membership password format next three down here and get the connection string from the config  file and then lastly will rejoin his bring in the machine key section of the Web config file which is conceived by the con him on one  of seven has to do with encrypting and he couldn t think our key information that is quick and methods from the base class that are implemented  here so what want to do is to stick a couple of these methods will look at how they re implemented in what the approaches and then  you can look at the other methods in your leisure by downloading the simple source code because there s a lot of consistency across the methods in  terms of the approach lets take a look first at the create user method consists ever important method in our membership provider for the create user method does  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Is it rude to receive seeing down a number of pieces of information from a base class and once the user is created there  is a membership user object death returned and this is the standard membership user object that would be returned by any other provider including  the default SQL membership providers while we re doing is just interceding in the process and getting the information for the membership user and  populating that object our own to first thing that happens here in Tikrit user metadata as we set up that the user will be  validated once we ve created in by creating an instance of the arguments for validating the password and then calling me on validating password  method that if you get a cancel return from these arguments in the call to the validating a password resets status to the invalid  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Password and we asked you don t create user and his return from the method next we take the e mail address and we determine whether or  not he current settings require a unique e mail and if so then we go out to the database and see if a user already exists for  the e mail and if they do exist was at the status to their duplicate e mail and we returned from creating user next on here on  361 we take the username co opted to get user method and see whether or not we get a membership user object back or whether we get  it never should user object is populated with data because if we do not get a membership user bag that means user doesn t exist in database  and then we can go forward with creating the user to create a user we have to set up a number of parameters that are passed into the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Procedure in this case it s called user_INS and both these guys come in down to the create user method to recognize many  of the names and then once we set up the parameters we execute the stored procedure and determine whether or not it was  successful and if it is reset our status to success otherwise it said two rejected and then once we know the user has  been successfully created down here on 397 recall to get user method passing username and it returns a membership user object instance which  is then return from the create user method next let s take a look at the validate user method and this method is  called every time you try to log into the system of username and passwords let s see how that one works to the username  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Password come in down to the method and mom were done we return tour false whether or not we validated our user s the first thing  that we do here in the metadata used to take username and execute a stored procedure that goes off and gets us the password is currently  on file for the user and is a particular sore procedures for the user_validate go off and execute that open up the SQL data reader and  we get some of the values as I said from that reader or the row corresponding to the user in the table all in the database  when is the password that s currently on file and the second is whether or not the user is proved and once we have that information  to call a check password method which is utility method in a class that takes the inbound password to the validate user method and compares it with  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;The password that stored in the database and wanting to look at is because the check password method contains the logic that allows us  to compare our inbound password which is in plain text format to store password which may or may not be hashed to the finance  the definition of the tech password method and see how this works entered and stored password coming down here and then based on what  the format of the password is in this case we are doing with encrypted or hashed password that same rehab a hashed password what  happens is they been called these include password method takes the plaintext password that the user typed in and encodes it and then we  compare whether or not it s equal to the one that comes from the database that include password method is right down here and  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=84"&gt;Minute 14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;One important thing to note is that it is using the machine machine key section from the web config file and  ancillary there is an honor code method down here if our password was encrypted let s go back up to our  validate user method so if after checking our password to passwords are equivalent then we look to see whether or not  the user is approved if they are approved we consider this a valid user and then we make a call to  the stored procedure which updates the login date for the user so they were able to track of the date and  time that each user logged into the system now if we do our password check failed or what happened is we would call a separate utility  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=90"&gt;Minute 15&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;At it which updates the database to indicate that are user try to login but if they ll down here on  line 30 returns the local variable_is valid which indicates whether or not the user was successfully validate the third method that  I have us look at here is the reset password method but this does is it takes in the username and  the answer to their security question and ultimately returns the new password for a salient to do starting on 766 is  find out whether or not the user has enabled or the application allows users to reset their passwords if not we  thrown exception otherwise we move on and we look and see if the user didn t supply in an assertive security question and we are required  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=96"&gt;Minute 16&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Is upon our configuration to have an answer to security question in update the failure count for the user and  Troy exception however it is that all looks good then we create a new password using he generate password method  in the net framework membership namespace chloroplasts rather and we use the length of the password comes from the configuration  file as well as the minnow number of required non alphanumeric characters now once we have that new password we  take username and password and quality on validating password then we test to see what they re not that was  successful if it is successful then we call a stored procedure user_get password answer the purpose of this or procedures to take these  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=102"&gt;Minute 17&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Amen the application and retrieve for us the answer on file to the user s security question is whether or not they are currently locked out  because they ve exceeded the maximum number of password attempts so following the call that stored procedure first thing we do gays get the value from  the result set that indicates whether or not the current user is locked out if they are thrown exception and if they are not locked out  then we take the answer from the result set and stored in a local variable next idiot we are required by the configuration settings to have  an answer to security question within call a utility check password method at this hour passing ash the answer provided by the user to the answer  from the database and the same method that text password actually compares the two answers and tells us whether or not their equivalent of the article of the equivalent  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=108"&gt;Minute 18&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Then we update the failure count for the current user had thrown exception if they are equivalent then we call another sore procedure  down here which updates the password for the user heading down it takes the new password here to score the Red Sea can  see that and aging codes or encrypts the password and has said in his parameter to sort procedure and its stored in the  user s record in the database then funny once that s all done retake the new password and returning from the reset password  method now there are a host of other methods here that you can see and most these methods follow a very similar approach  they either gay values from the database update values in the database compare some values that are either passed into the methods to configuration  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=114"&gt;Minute 19&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;News etc to determine whether or not the purpose of the method is being carried out early to do here before we leave our  custom membership provider a treatise have a website and implemented Cisco back over SQL Server and we ll take a quick look at the  various stored procedures that are used here just to get a perspective on what the sort procedures are and as with the additional methods  in the actual implementation of the provider if they look at these stored procedures in the sample code South Qu bec order Visual Studio  and test out our custom membership provider in the sample website lets create a simple website road test out our custom membership provider first  let s build the provider to make sure that we ve done everything correctly and it looks good now would create a simple once  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=120"&gt;Minute 20&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Eight discrete regular ASP net website and let s call this website TV the first thing we wanted to  hear no website is at a reference to the custom membership provider that we created over here in the  class library and what we can do is add that reference correctly to the project in our solution if  it also created bin folder on your own and copy and paste the assembly into the bin folder to  another leave includes a reference for custom provider we wanted and some membership configuration information to the Web config  file round here in more than one ad is a membership element will set the default provider if he is a HCI or  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=126"&gt;Minute 21&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Shift provider and then want to add an empty element for  the provider is little clear and existing providers and now we  can add our new provider so let s give it a  name equal to ATI membership provider pan next move will enter  the type attribute is the fully qualified class name so in  this case of HDI ASP net membership I d HDI membership provider  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=132"&gt;Minute 22&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Will set the connection string for our provider and that  is equal to HDI connection string and that s defined  up above in the web config file in the connection  string settings are rather elements and let s set enable  password retrieval meet with the shrew and let s also  enable password reset for that one and let s require a question and answer to  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=138"&gt;Minute 23&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Pen and that looks good so this provider here in the web config file rather than membership provider that we ve defined here  will cause our website to use the custom provider rather than the any other provider such as the SQL membership provider that comes  with ASP net and before we leave the web config file here I just want to point out up here on my 55  is the machine key element lead the key values that are used for encrypting or hashing of the password as we saw what  we re looking at the custom membership provider code let s close this down here and now wanted like to do is create  at a few pages and on our default page will do is we ll just say this is the how little labels of his faith have  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=144"&gt;Minute 24&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;July and this is the custom membership provider and this is just the simple little labels so that when this  page comes up we know what it s finished to other pages that might create test out our provider and  the first one is going to be a page called create user which will do as the name implies and  then the other is a login page and with his name now a login splits put a login control here  on our login page with over the toolbox down under login will get a login control drag it over here  on our login page and that in error and scored for a create user page and take one of the standard create user  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=150"&gt;Minute 25&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Wizard controls and put them here as well and now it should be all set to test out of our little  website now use a custom membership provider for you test out the website I want to do is open up our  custom membership provider class and set a few breakpoints in the first one I want to set is up in the  create user method and then the second one will be down in the validate user method is now are all set  to go just make the create user page are start page syrup the website in a debug mode will get this  standard pretty user form from the create user Wizard control lets fill this out and pull this test user one password will make password  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=156"&gt;Minute 26&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;E mail won t test you through one that tempt out or security question lets use favorite dog and that would  be Dino now a click create user to see we jump into the create user method to go swallow logic that  we just saw one review that class let that go in and up and validate user names here and go through  all the logic to determine whether or not the current user is valid that we saw and when we finish up  with that seaweed successfully create a new user to click continue and center now authenticated login we have access to our  homepage so now let s go back and this time will make default aspx via homepage and I should note that a  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=162"&gt;Minute 27&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;All of the access for anonymous users has been turned off years when a return to access any page including the homepage  will be asked to authenticate zealots started up began and this time were redirected to the login page lets login as test  user and put in password click login and invalidate user again it goes to that logic and when it s complete it  authenticates us and were redirected to the homepage was to shut down the browser here I want to go back over to  SQL Server and just take a quick look at the database table users where were storing our information and you will see  here we do have one row for test user wants of the information that we entered in our create user form was stored in the database  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=168"&gt;Minute 28&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Set an example to the major operations are custom membership provider creating user in validating user as you saw what we went through the  code there is a lot of properties and methods here from abstract base class that are implemented by encouraging to do is download the  sample source code installed on your machine and use breakpoints as a means of stepping into various operations such as entering too many invalid  passwords so the summer and what we did is we created a custom membership provider by creating a class library and in it and  we had a class called a generous provider that I heard it from the abstract base class of membership provider from the net framework  memory and submitted a number of abstract properties and methods from that base class I hope you enjoy this video on how to create a custom or merchant provider  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_8&amp;&amp;bookmarkIndex=174"&gt;Minute 29&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;This  is  Chris  tells  thank  you for your time  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/videos/video-189.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-3511638381021133656?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/3511638381021133656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=3511638381021133656' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/3511638381021133656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/3511638381021133656'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-how-do-i-create-custom-membership.html' title='Video: How Do I: Create a Custom Membership Provider?'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-7442531807435880914</id><published>2008-08-25T23:00:00.003-07:00</published><updated>2008-08-25T23:00:49.082-07:00</updated><title type='text'>Video: How Do I: Use Cascading Style Sheets for Web Page Layout?</title><content type='html'>In this video we learn how to use div elements in combination with cascading style sheets (CSS) to create robust and higher performance web pages. The div based approach will be compared to the table based layout approach used by most web sites over recent years. Then, several CSS-based approaches will be shown, ranging from absolute positioning to floating elements. We also learn the benefits of separating structural HTML from design with the use of CSS.&lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Hi this is crisp else in the city over to learn how to use CSS based page layout with developments in recent years  most people have used HTML tables to create layout on their webpages and in fact by the majority of the sites on the  web still use tables as a major basis for doing a page layout however more and more sites are using developments in conjunction  with cascading style sheets to their page layout because that approach offers several advantages the first thing is that typically a tape based  page layout has considerably less HTML that has to be sent down to the browser so it s leaner page and that has  an impact on performance in the second somewhat less obvious advantage is that when you used to the elements you can position the content in your reach  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;GML so that it is sent down to the browser and displayed first lifetimes HTML tables have quite a bit of HTML markup  before it actually gets descending the content aspect of the page down to the user and displaying the content first has been shown  to have a distinct advantage on the perception of the user towards the website because they like to see the content first and  not have to sit there and see graphics and navigation or whatever and then wait for the content the third advantage is that  by using cascading style sheets in conjunction with developments there is every small degree of separation between the structured aspect of the page  layout which is the development in the HTML and cascading style sheet which represents the design solicited look at a standard cable based page layout  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;No go on and do a number of database cascading style sheet layouts to show you how to compare  and some of the basic principles so you can implement them on your own websites and create a website  here and in our anti solution or used to create a number of test pages demonstrate the principles on  which this his website he be and must create our first patient will will do a table based layout  and will let s call this page layout table for three DS will lay out here using tables and  let the ball we want to achieve is a left hand navigation column and then the rest that a  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;On the right side will be the main content area lets create table here and we ll give  it a with equal to 20 in the BR navigation column and I skipped that 100 and inside  here let s put one row and narrow will put one column little text here so we can  see it will run the page navigation links and let s just make this cell to vertical alignment  to the top damages to a format that H Novo bids with a more readable for you to  the far left hand navigation column is just use this as a basis for our right hand content column and the red  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;In London will make 80 of the page and will keep one cell in here and watch us change the  text so we can see us or call us what content and just to make things a little more obvious  for me at a style and here rarely set the background color of the content column to blue and will  take that style put it up here in the navigation will give the navigation hate yellow You could live say  we want to do here is to take our content table in a cell line that the right and the  last thing we can do is just get rid of our development container here that came into the page by default let s reformat  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And one more thing here let s put it a lot and it equal to left okay and let s choose to run  this patient take a look at out what it looks like and as you might expect we have our navigation column on the  left hand a content column of the right we could go further here and we could take this right hand content column and  put a nested table and here attacks a three columns of content etc says basic table based approach to pages which think many  of you are familiar with Bella salon and do the give approach and see how we do that Cisco hadn t create a  second page go to our first they play out sample and let s call this new layout one creating several of these mousedown in a  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Several kids to the page here and they differently come our major containers for areas of the  page much like the cells of a table s let s make his first one an idea  of header and you see why were doing IDs in just a moment as copy that wouldn  t create three more kids here and the let s call this left column make the next  one in content and will make the less on the footer and I was just at a  little Texan e g someone it s displayed we can recognize that sections of the footer content left column and header  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;List is run this sensitivity looks like and I expect the they are in a flow layouts for getting them sequentially down  the page cells go back and will we need to do is add some style information to cause each of these dudes  position on the page as we would like them now good practice is to create a separate cascading style sheet and link  to it from the page so where can I do that over here and will add a new item a cascading style  sheet chemical is to lay out 1 C assessed his name matches the page when you get sent source code it ll  be easy to figure out in any year let s create a style in the element free to those students we have header and  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Left column to have content area footer and now we are seeing the Palestine as  the prefix for the name of our Saturn such as in food because disorder were  called element IDs and element IDs refer to the ID value or rather the value  of the ID attribute on the element and as you recall over here in our  page we gave the IDs of header left column content and footer and specify where  naming these cascading style elements accordingly are an important thing to consider when you re naming things is that  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Make it a class by using the prefix rather than the town son slept there is  some attributes the styles I the first one let s just add a color of zero  and zero and let s go to a position and will make this absolute and thus  beside the top of this zero pixels to left zero pixels hate with 800 pixels and  a height of 100 pixels in a let s just take these style to use and  for making quick or let s just talk him down here in Oregon and it s of these values  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Some thoughts on let s just change the color here 200 and let s offset it  down to 100 pixels lit on the left there zero pixels that spake the wit to  150 pixels is our navigation left and let s make the height of 500 pixels and  down to the content and will make this color FFF make the top 100 visits at  the same level as he left column make it a with the 700 and a height  of 500 and four first section lets face it back on color that and let s put the top hats  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Hundred because it has to be down below both content and the header lets face it zero with that as it are pixels who aren t all  across the screen and we ll leave it the same night as a header at 100 pixels so that s good we need to go back over  here to our page and will put a link from the cascading style sheet to the page or a drag and drop and cascading style sheets and  that is for calls with one more thing we want to change appear in the cascading style sheet I see that the left of the left value  of zero so that would put the content right on top of the left calls us make that 150 so it s out to right so trivial  said let s fire up the page here and take a look at what we have and it is what we expected them to make this little bit  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Bigger and you can see we have our header up here which is at 800 pixels are a left column on content and down the  bottom we have our footer suite of use absolute positioning here to get a nice standard page layout and we ve done that back here  by separating the design of the page and cascading style sheet and the actual HTML is a rather simple noses and bad but let s  say we want to add a right handed column as well as a left hand column what we have to do now to that typically  would do is just at the right column right here on the same people are going to do is just quickly create a second page  so when you get the sample code you have this first one intact at a new stylesheet and page here and so all called us to lay out to  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And let s add another page and will call that one dude layout to as well then one  didn t do is go over to the first page and I ve just can take all of  this HTML right down the head and body tag and were giving over here to this and paste  it in the school speed up over doing here and there would have a back to the first  cascading style sheet copy everything there will back over to the second cascading style sheet and pasted it  on the disk cleanup things here are quite closing a few of these will Windows get rid of the original  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=84"&gt;Minute 14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Table wine in this default ASP access well for seemingly to do is NR right hand  column in the HML solicitors take our left column copy pasted in here and already do  it is rename it attacks and also here in the ID now let s go over  to our CSS file and take the left column style copy and paste that we use  that as the basis for our right hand column now our header and are left column  will stay as is in the right column we ll do is make its left value to be 650 and effective  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=90"&gt;Minute 15&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Lets to see the content of 500 cents space to same in this case in the footer is staying the same as well positive of  the page and all open up the browser here and now we have far right hand column so it was quite easy to add another  column for a layout we really just as it did to the page and edit another cascading style sheet and not much more than that  soon both his first and second example we ve been using absolute positioning of our kids on the page now let s make birdcage in  this time or can he used the float style attribute to get the kids to float next one another on the page rather than absolutely  positioning them some go ahead here and create a new style and a new page was paid for his tears as he did lay out three and  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=96"&gt;Minute 16&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;You would create a corresponding stylesheet and will call this did layouts for and that s just copying the HTML  is over from number two necessarily doing this does so when you get to sample code you can have all  these different approaches as separate entities were specifically we could just edit the one page slowdown here Lopez in HTML  there and let s go back to the two had take the cascading style of battery or three pace that  in and let s just go over here to three and take our new cascading style sheet put in a  link that there are close down our number two pages now we don t have to do anything to the HTML  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=102"&gt;Minute 17&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And witches can edit cascading style sheets so this is an example of how the design aspect is really quite separate from HTML  because they want to do here is because were not going absolute position anymore I want to add a body element and set  a couple attributes at body and here and I want to set the margins to zero to zero pixels and if heading to  zero pixels fumigated out into the header handling and get rid of the absolute positioning and just let it flow in line since  its first 18 element it will naturally be at the top of the page and banana takeouts positioning for the left column and  in its place work to put the float element or attribute which will float our element to the left in this case swift and so does  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=108"&gt;Minute 18&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Is it causes the left column to voters stick to being a left side of the page and can take that number into  the same thing for the right column and the same thing for the content and not down here will take out the absolute  positioning for the footer as well global we want here is the clear attribute and what clear attribute does is it says okay  let s clear any food attributes that have been said in previous elements because the Florida feud spilled successfully successively rather odd one  another okay let s fire up and look at the page in the browser and there is the page has a very similar  looked when we did the absolute layout but were floating the left content and right columns seizing the fun attribute is an improvement because we had somewhat less  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=114"&gt;Minute 19&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Code so to speak over in the cascading style seem so its earnings little smaller dopers are dealing with a fixed  width columns how would we create a column based layout where they were more fluid war as the term is liquid  with a width of the columns would change as we resize the browser or more importantly as users who are running  the page at different resolutions have different widths available on the screen and they would get the same basic appearance of  our page was creating a fourth page that s based upon our number one page and also a style sheet will  add that in here and this will be to lay out for the stylesheet and also to fail for for the SPX page  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=120"&gt;Minute 20&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And less close down the number three here and we can go over and open up one we can take  the HTML and one and copy it over here to number four paste it in here and let s use  the style information from number one and put that TNR number four style as well that s closed out her  number one suggests though we don t start to edit them so once again our HTML doesn t have to  change all just to reiterate that would have two columns are left hand navigation column and then the main content  area off to the right of it since for nothing is absolute positioning here I want ahead in a body attitude began her  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=126"&gt;Minute 21&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Style element in the zero pixels for the margin and zero pixels for the petty okay so what  would you do differently here starting with a header and get rid of the absolute positioning and instead  of an absolute width of 800 pixels revenues of 100 for our header and then for our left  column we are going to get rid of the absolute positioning as well and here were also in  the use of percent in this case 19 and similarly for the content in this one were to  make it 80 and down in the footer or the absolute positioning and this one were going to make 100 dislike the header  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=132"&gt;Minute 22&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Now let s go over to our page and its food and anything can tour cascading style sheet and there s one  more thing we need to put over in our CSS and you can offload the left column and what it looks good  enough to float this one to the left in our content in this case in a float to the right know a  lot sort of browser here and your page and there we have a header column content as well as the footer down  here for what s a little different about this is the matter how big you make the page our columns header and  footer all will resize the percentages and this is more fidgety appealing and also represents fact is they said that this page would work better than  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=138"&gt;Minute 23&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Fixed width size and are ours browsers with a lower resolution coast is found  in our last but not least I would we do a three column approach  here and let s create a new number five page and cascading style sheet  and said he do that style sheet number five is to be largely based  upon number for this let s take all over the style information in number  four put it in number five take the HTML and four copy that and put that over in five  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=144"&gt;Minute 24&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And I got a form tag here so let s just get rid of that away almost got in  there and let s link in our number five stylesheet and the other thing we want is to add  a right column as he talked about 10 are HTML is all set to air it appears will check  that out in a minute of snow over to our number five and we need to do here in  our stylesheet is just at a style for the right hand column and put that down here and all  we want to really do here is change the float attribute to write for the rightmost column and let  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=150"&gt;Minute 25&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;For the content and let s make to our left hand column now 20 will make the content 59 and then  20 for the right hand column and with immunity to do with our footer down here and need to be clearer  attribute and both see here that we forgot to rename this list is rename this style to smell is open up  this page in the browser and take a look at it here we have our layout as expected with a left  right columns content in the middle pair on top footer on the bottom and what s different about this compare to  the fixed width layout that we did earlier with the left and right column is watch what happens as I resize the browser  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=156"&gt;Minute 26&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;You can see that both the left content and right column are nicely resizing according to the width of my browser window  in this case or it could be a different resolution of the user s screen list of examples of a gone through  your shoe several different variations are used it for laying out pages from absolute positioning and fixed with dudes fixed height is  to the last one where we had floating kids that were based upon which the percentages so that the whole page layout  resides very nicely as the Thursday browser window or screen resolution changed it to expand upon what we ve done here for  example by taking the content area of the page and aiding some container is inside of the content do that would partition the content  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=162"&gt;Minute 27&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Area in to save multiple columns of content for a newspaper like approach or you could position certain goods in certain places within the content  area all to achieve different effects and you could put that style information in outing cascading style sheets for each of those approaches in the  content area so you could have saved several standard formats to your content area and then base upon which cascading style sheet you linked in  you would get a different layout to the content I would like their useful issue would have several different types of pages with different layout  you may have your home page which has a standard layout and then a main content page for sub areas of your site and then  the third type of format might be for content detail within each of those subareas committed to more complex situations like that the benefits of using the deep approach  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=168"&gt;Minute 28&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Are much greater and then if you try to do the same thing with HTML tables and it noticed as we well all here that I talked  that one of benefits early on is that you have a separation of the design aspect from the actual structure of each of the elements of the  page the Nets played a very nicely here where we have different cascading style sheets associated in this case with different webpages to provide a different layout  and assistant is really a bit tedious to give the team working on page design or even if you re by yourself and seven pages is it  really segments things very nicely so encourage you to download the source code for these different examples use them as a basis for implementing some different page  designs in your own sites and by the less punishing make is that one of the things you will run into in the based layout is that  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_7&amp;&amp;bookmarkIndex=174"&gt;Minute 29&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;You absolutely have to test your pages  in the major target browsers for your  website so be it enjoyed watching this  video and learned something about how to  page layout with descent cascading style sheets  this is Chris Pelz thanks for your time  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/videos/video-188.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-7442531807435880914?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/7442531807435880914/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=7442531807435880914' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/7442531807435880914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/7442531807435880914'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-how-do-i-use-cascading-style.html' title='Video: How Do I: Use Cascading Style Sheets for Web Page Layout?'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-4021844328900552170</id><published>2008-08-25T23:00:00.001-07:00</published><updated>2008-08-25T23:00:45.912-07:00</updated><title type='text'>Video: How Do I: Handle Application Events using an HttpModule?</title><content type='html'>Learn how to create an HttpModule that handles application events during the processing of a page request. The sample module will write information to a log file at various points in the page lifecycle. We also see how the HttpModule is configured for use in a sample web site. &lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Hi this is for spells in this video were to learn how to create an HT key people  to her in ASP net for seeming to do to create a filter is to create a class  that implements the IHT keep the module interface Soquel peering at a new project or solution and would  include this in Visual Basic and will make a class library project and let s close HET be  filtered DB craziness as is said in the DB could easily created C sharp let s call our  class eight TTP filter to the screen name adhere to an end stereo and we need to have a reference  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;To the system Web namespace so let s add a reference here because that will be  in our project by default Okay adhere to system Web had a reference for that is  to show all files here and check out our references to become okay now roll set  to start implementing our class and as I said it needs to implement the IHT keep  the module interface lets put that in canal and Megan are life user here within into  it at a few imports to our class so we can don t type the fully qualified namespace  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;then many hearing led us to a system Web and let s put system diagnostics and while were  at it let s define a namespace here and let school in the HDI for how to why  it s closed that off here are a unique implement two methods for the 80 IHD module interface  is hard in our little squiggly line here so I ll just pursued into that hit enter and  we get the dispose and end it interfaces that we need to implement for the minute event or  method is called when the application in this case the above application is initialized and the dispose has called one age  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Stamp so ridiculous here in our sample is right out some information to a text file at various points in the filtering  process to show how you would capture information and at least one way that you can write it out I was to  be a lot of options for writing out information if that s what you want to do solicit up with the private  variables here in the first on the setup is a name for the file where we store things minimalist set up a  file writer innocence of the screenwriter actually mandatory in our writer information and out and so this would be a system I  O Stream writer and we will store the context variable information which comes in down to the mid method down below slit  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Make a private rainbow handle calls this application contexts and said he is going to be an instance of a  TTT key application of it has started here in a lesser known tidbit method and add a few things in  here and firstly wanted to use create a file named so that we have some place to store the information  of and for the demo over to do is take that filename variable in who we are going to take  the application column context coming in here context object that is contained within the application and the request and down  requests and will take a fiscal application path so it puts it in the folder where application running and let s just call this  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;HDTV PE cultic IPX kicks the then as I said is couple of the things we want us to our soda  the next thing they ll do here is take that model wide application context variable and in the end we will  store the inbound application context passed in mid method and it looks good for starters okay let s read out the  first information for file here in the end it methods it to do that we need to set up our file  writer can be created up above so that the new system I O Stream writer and here we need to pass  the file name that we have stored in the module variable and it will set put true to indicate that we wanted opened  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Be a pen mode so what will an array let s write out here right line and will  just write in the current date and time is now to such strength and this is just didn  t be a timestamp as to when we write the different things out the hour is in its  second sailboat fractions of a second because this will be going through pretty quickly and right and then  let s just write a brief message that says and it so we know that it is in  this part of the program at this point in time and womb is flush out the contents of the writer  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And four in this demo were that close to writer here so lets to the same sort  of thing out there will title your let s just correct to bad there we go through  what do the same sort of thing up in the dispose method so will copy this here  at this up here so that we know when we re in the dispose method and will  just change in it to dispose so this point now always done is write out some information  for text file for the initialization and to dispose of the application I see you could do  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Trust take a look at and this word document is included in the sample code downloads a look at this and are also available in the online documentation  MSDN as you can see here there is a number of points in a processing in which you can intervene and what were Hindu leaders implement one of  these as an example of how you would implant all the rest them up into a begin request event for one thing to note before we leave this  and go back to Visual Studio is that this list here indicates the order in which these are events are fired so that if you want to intervene  at the processor do things in a certain sequence you need to consider the sequence in which the events are fired so we ll go back or to  Visual Studio now and let s implement the begin request event so in order to do that first thing we re going to need to do is win it will appear to our  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Module line variables and we need is another one which will be an event handler for the begin  request event so bad that I will call it the EB games request event handler and medicine be  of type event him and we need to add that an event handler down here when the application  initializes so want to then write down here and we need to a head handler then we want  to add that to the application context begin request the event and he can see the list of  events that we just saw the Word document and this will be implemented to map to and on the game  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Request event with Chandler which were then ahead momentarily here know you didn t down  and create that event handler county or demand and a proof to do so called  on begin request and that s going to accept it he send their this object  and the event are says that talks so this event handler will fire at the  beginning of any request to our website so there is more and more little bit  of cleanup that we should do with respect this event handler and what does that appear  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;In our dispose method and what will do here is that we will  remove the handler and that s and application context begin request and we  are removing the begin quest event and are then then we will just  set that event handler damages from equaled nothing to now let s write  some information out for file every time that begin request event fires so  we ll take our code here very in file included down here in our begin request event  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And we will just write out here on begin request since this event fires  every time have never quest starts less said than a little more information now  were riding out toward file here and let s take that application context and  its go to the request object again and let s take the user agent  information right that out in the pool that s right out of a couple  more pieces here and will read out the user a host address and Leslie  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Let s write out the one we read unless they do URL string and write that celebs  galore should be all set here to test out Ari Kiki to your filter or who he  had lessened information being written down when we initialize and dispose of the application as well as  with the request in order to install and test our filter the pressing need to do is  compile the assembly selects to that and everything looks good there now we need to add a  simple website where we can install and test the filter when a new website is an ASP net website handle website DB  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=84"&gt;Minute 14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And then the first thing that will need to do in the website is that a reference to our assembly  that contains REH cheeky PE module will add the reference in this case will just reference the class Library project  in our solution and we need to go to the web config file and Ashley install the eight TT piedmont  will do then we add an element to the HDTV modules section and we need to head the fully qualified  class name and as each TTP filter VB namespace as HDI and class and as each TTP filter need to  give it a unique identifying name test the HDTV filter and then we ll were given to it is covert hard to fault this  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=90"&gt;Minute 15&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Ask page and to settle Texaco need to have text in order for the module or the folder to function but this so let us know that the page  has fully loaded which is what testing HTP he filled her and then in order to see what s happening at different points will set a few breakpoints over  here in our class at the beginning of each of the methods and data will allow us to see when we hit those different points in the application and  on around this in Firefox rather than IE because if we run it in IE in the debug mode and then we shut down i e it shuts down  the debug mode in Visual Studio and we would never see the dispose method being reached it would be reached and it would write out our text or text  file but we would build to see it but we do it in Firefox which doesn t automatically shut down the debug mode Visual Studio we will see it reached that breakpoint  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=96"&gt;Minute 16&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Sluts make our website the startup project here and let s fire things  up in McGill started in me debug mode and will lead the Web  config be modified to enable debugging in the first method please should hit  is our ended method and there it is for the applications starting who  will continue on from there and will next reach the fun begin requests  which is handed we added to be called right when the request is first initiated  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=102"&gt;Minute 17&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Going in the debug code in Visual Studio for what I ll do is only down to the local server and stop that and  when I stopped that you see that we reach the dispose method will let it continue on actually shut everything down to look back  over to her website here and just refresh and we should see our log file know which we do let s open that up  and see here is the log file and it particles will resolve the debugger first we rode out from the initiative and then beyond  begin requests when requests first started from the webpage and aide wrote out some information about the browser of IP address URL and then  we get dispose event has hit Haitian shutdown so this particular sample we intervened in the processing of an HDP module by adding an event  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=108"&gt;Minute 18&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Pour on begin requests and as I mentioned earlier there are a number of events where you can intervene and  do various things here we were recording information but you could perform any activity that you need at any of  these points in time in summary in this video we learned how to create an HT key piece filter by  creating a class that implemented the IHT keep the module interface are too required methods dispose and admit which we  implemented then there s a list of methods which will represent the various points in the processing of a page  where you can intervene and to whatever functionality you need to do at those points in this case we implemented the begin requests  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_6&amp;&amp;bookmarkIndex=114"&gt;Minute 19&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Load the source code that  comes with this video take  a look at it in  more detail hope you found  this video informative this is  Chris Bell s thank you very much for your time  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/videos/video-187.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-4021844328900552170?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirectory.blogspot.com/feeds/4021844328900552170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=6610419525310410391&amp;postID=4021844328900552170' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/4021844328900552170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/6610419525310410391/posts/default/4021844328900552170'/><link rel='alternate' type='text/html' href='http://screencastdirectory.blogspot.com/2008/08/video-how-do-i-handle-application.html' title='Video: How Do I: Handle Application Events using an HttpModule?'/><author><name>Aravind</name><uri>http://www.blogger.com/profile/03064317660700591401</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='25' height='32' src='http://1.bp.blogspot.com/_BgNGam39Xbo/SkgDItcI1BI/AAAAAAAAAM8/O3wYcJKDP3E/S220/profile.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-6610419525310410391.post-1940462264542282155</id><published>2008-08-24T23:33:00.007-07:00</published><updated>2008-08-24T23:33:10.707-07:00</updated><title type='text'>Video: How Do I: Utilize the CSS Friendly Control Adapters?</title><content type='html'>The CSS Friendly Control Adapters allow you to alter the HTML that is rendered by a standard ASP.NET 2.0 server control. In this video we learn that the standard ASP.NET Menu control renders an HTML table element, but with the CSS Friendly Control Adapters the same control will render an HTML ul list element, improving the menu’s accessibility and presentation. &lt;br/&gt;&lt;span id="fullpost"&gt;&lt;br/&gt;&lt;font color='blue'&gt;&lt;b&gt;The following text is a &lt;a href="http://www.amazon.com/exec/obidos/ASIN/B000H2049I/directorforsc-20"&gt;software generated transcript&lt;/a&gt; of the video. Click on a minute link to jump to a location within the video&lt;/b&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=0"&gt;Minute 0&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Hi this Chris tells from identify com this video would you learn about something called CSS control adapters to what our CSS  control adapters well in net 2 0 Microsoft introduced a new class in a new concept called control adapters that allow you  to intervene and alter the rendering process for ASP net server side controls is a sure you re all know it s  pretty easy to use a server side control like a menu control he just put some simple syntax on your SPX page  and then the net framework handles the rendering process for all the HTML markup that actually is sent down to the browser  when you re a new control renders however many people have expressed an interest in controlling what HTML markup is rendered when you re it  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=6"&gt;Minute 1&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Is the net server control goes through its rendering process thus the concept of control adapters was introduced so let s get started by looking at  a simple menu control adapter that I ve built here from some of the sample code in what s called the control adapter toolkit and then  we ll dive into the details sort than here is to set up a simple website that has a page on it where we ve implemented  in ASP net menu and this menu uses the CSS control adapter for menus let me fire up the sample webpage and we ll take a  look at it and as you can see it is pretty straight forward looking menu of options here so how is this different from the traditional  ASP net menu when it s rendered down here to the sample page sensor that question let me flip back here to Visual Studio want to do is  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=12"&gt;Minute 2&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;To open the same page again but this time the open in Internet Explorer as she saw we had that first sample page opened in the Firefox browser  and readily concede that this menu looks very different than the one we have over Firefox and yet it s the same page so what s going on  here while this page in IE is being rendered using these traditional ASP net menu control which looks very different than the one we saw in Firefox are  explained in a few minutes why using the same page in two different browsers is being rendered a different way that I see one of the neat features  that we have with the control adapters and in general but first let s look at the source code for the menu here in IE will view the  source and will scroll down and look at the part that pertains to form a new class and its breakdown in here as you can see the menu  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=18"&gt;Minute 3&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Is being rendered as an HTML table which is the default way that ASP net menu server side control renders its output so now  let s go back over here and look at the Firefox version and to do this we can use a little cool colt firebug  to send me dead on Firefox and what this allows us to do is look at the HTML here for the menu and we  get down here into the menu class and we can see right away that this menu in Firefox is rendered very differently because it  s using a CSS control adapter and its rendering and unordered list with a variety of list items so we ve done here is  that by using the CSS control adapter we have completely change the rendering process for the ASP net menu control to render an unordered list  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=24"&gt;Minute 4&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And list items and let s go now and look at the code in Visual Studio and see how we make that happen solicited look  at how we implemented the CSS control adapter for the ASP net menu control in the sample page of a just saw the first step  to doing that is to show you where you can download the CSS control adapter toolkit which has all the pieces necessary for implementing this  on your own websites and to go off in search that you may end up in one of two places and one of those places  is on ASP net CSS adapters and as you can see here it says if you can download the source code however in March 07  Microsoft to open the development of this to the community and now it is maintained on a page in code plaques which is complex com CSS from  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=30"&gt;Minute 5&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Apoplexy have access to all the different aspects of the project including the current release is and let s go there and look at the releases  that are available in one of the things that has been done here in a complex project unlike the original release of source code on ASP  net site is that he team has created an assembly called CSS from a dll which allows you to more easily incorporate this functionality into your  own website and of course all the source code is still available in the full toolkit as it was an ASP net site so I m  in a show you both the use of the CSS friendly assembly and the entire source code in the sample toolkit lets go back order Visual  Studio and take a look at the sample project knife to website projects you are one uses the assembly which I just mention that you can download from  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=36"&gt;Minute 6&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Plaques and the other one is a website that installs the full source based version of the CSS control adapters said he wanted use the source  code based version of the control adapters which do is in a create a new website using a Qaeda a new project template that has been  added to Visual Studio to forgo care to solution and click add a new website to see that there is an ASP net CSS friendly website  project type or template here that you can use and that s what I ve done to create this up her website called friendly website known  inside the source code base version you have all the pieces that are necessary to create CSS control adapters for the so called out of the  box adapters I should say for a variety of controls now there are a couple pieces to the CSS control adapters must take a look at an  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=42"&gt;Minute 7&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;First is the actual source code that implements the adapters here you can see their source code in the toolkit for a several of the  comment that controls a refined in ASP net and then also you will see here that there are simply corresponding style sheets that map to  the different type of CSS control adapters that you can implement because one of the major differences and purposes of having the CSS control adapter  is that as we soar you can render the HTML for the control in an entirely different matter and that s a essentially part of  stand what you would implement for the standard control adapter in the net framework over what we re doing here is that rather than use  some of the style related properties for controls such as font size and color were leaving the implementation of all of the look and feel  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=48"&gt;Minute 8&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;To control to a cascading style sheet instead and this allows us to implement our control in a more pure dynamic HTML approach we  also have some JavaScript files here for some of the controls that can see it in the new adapter has JavaScript file so in  the case of the menu that we saw in our sample webpage that would be three pieces to that is the code in the  VB class appear for menu adapter that actually overrides and implements the rendering process of the HTML elements that we saw in this case  it s changed it from a table to an unordered list then have the corresponding menu cascading style sheet here which implements some of  the core behavior type functionality for the menu control and we ll see how we would implement our own look to the menu control them  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=54"&gt;Minute 9&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;That s done in a separate cascading style sheet which we ll get to in a  moment and then in the case of the menus as I said there is a JavaScript  file that implements some of the client side functionality necessary for the menu to do its  normal operation so one approach to using DZ SysInfo adapters is that you can include the  appropriate source code files in your own website they would get compiled and then that you  would utilize the control adapter via that compiled version of the source code and the other is the USENET CSS friendly  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=60"&gt;Minute 10&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Of assembly version of the CSS adapter controls because that s most likely the way that you would want to implement them in your own website  and before we go off and look at specifically how that is implemented we should take a look at the menu adapter DB file here to  see what the source code is behind the scenes that s overriding the HTML rendering process you have a bit of a perspective on that let  s open up the menu adapter DB class and take a look at what we have here so essentially we ll were doing our men are  menu adapter class is that we are overriding the parent menu adapter class and adapters that menu adapter and then we are doing two things first  for overriding some of the methods in the parent class and then were adding some additional methods that implement the necessary rendering functionality that we want list  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=66"&gt;Minute 11&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Look here what s going on and essentially we go down here are the first method were overriding is the on and date method and  after calling the base on it we are registering the JavaScript class parses should say JavaScript file that s associated with a menu called menu  adapter jack JS down here and all of those that this code is doing is looking to see whether or not that JavaScript files in  a default JavaScript folder or it may be in a completely different folder and if you do move it to a folder other than the  JavaScript you need to add a tag to the Web config file swans we registered the JavaScript then the next method that were overriding is  the begin tag and me and tag rendering methods each of those methods received it receives an HML textwriter as day parameter and then that writer is used  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=72"&gt;Minute 12&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Write out the appropriate HTML to the stream going down to the browser and one thing to point out in the begin tag methods your  online 51 is that the first thing that s happening is for writing it did and that did this being given an active class attribute  online 52 called CSS selector class and remember that only go and look at the implementation or the decorative syntax for the menu control on  our actual webpage because that s a very important factor in determining which stylesheet values get used in rendering your menu going to want to  render another did as a container for the menu and one thing I should point out here that you ll see throughout this code is  that in addition to rendering the actual HTML element we are rendering class attributes for use in associating the appropriate styles and are cascading style sheet  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=78"&gt;Minute 13&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;To the different elements on the page and as I said the main purpose of this control adapter are really two purposes one is to render alternate HTML  and the second is to control the look of the control menu control in this case by using a cascading style sheet so here in this menu adapter  that VB classes were doing the rendering we are creating specific classes that are associated with different parts of the menu control in this case and so there  is a certain degree of standardization here in that you have to follow a convention when you re creating your cascading style sheets that matches the class names  are being implemented here during the rendering process and will look at the cascading style sheet in just a moment we ll see that in detail set to  render the begin tag we have the render and tag which basically closes things off and then the real me of this is down here in the override of the rendered content Smith  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=84"&gt;Minute 14&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;And in this render contents that they d were calling a method called build items and in that we are actually rendering all  of the menu items using the is unordered list and a list item HTML elements as we saw in the sample webpage and  I ll leave that to you to go off and download source code and look all the details of how were actually implementing  the rendering of the different menu elements however the basic approach is essentially the same or rendering both an HTML element and an  associated class attribute that allows that element to be formatted using a cascading style sheet now if you were to look at the  other controls are in here such as the details view data lists etc he would see a very similar process where the appropriate HTML elements and associated style  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=90"&gt;Minute 15&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Aims are being rendered for that control cell is go take a look at the other simple website that I had been planted here that we looked  at in the very beginning of the video and see in detail how you would implement in this case a CSS control adapter menu on your own  website so we ll will do is collapsed down this friendly sample website which again was created using the project template that was installed with the ASP  net CSS control adapter toolkit and will go take a look at our sample website here for several pieces that you need to add to the website  and the first one is in the bin folder the CSS friendly assembly you may not have a bin folder in your website so it s not  just create a new folder and place the CSS friendly assembly and it the second thing you need to do is to put the cascading style sheets that relate  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=96"&gt;Minute 16&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;To the menu control in your project or website and others to cascading style sheets shared the first one is called menu CSS and that actually  comes from the toolkit to pick over here the CSS folder you see here is that menu CSS and all I did was copy it over  to my sample website project and many CSS contains what we might call the behavior for the menu it doesn t contain through node contains very  little in relation to the appearance of the menu on the page so what you do to separate the behavior from the appearance of the menu  is by convention you should implement another cascading style sheet that has the look or appearance of the menu and I ve done that here in  the menu CSS file now the standard menu CSS file is pretty simple here and as you can see its guy just stay few styles in it that relate to  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=102"&gt;Minute 17&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;I m of the visibility and position of the menu and if we go over here and look  at the CSS menu again CSS menu is the cascading style sheet that I implemented specific to this  website to provide the look of bar menu on the sample page when important things to note in  our own CSS menu which again is specific to this page or this menu is that we have  created styles that extend the styles that are in menu CSS and in this case I ve called  all of our style CSS adapter menu so that we can differentiate them from the standard ASP net or ASP net  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=108"&gt;Minute 18&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Defending what we want in our specific menu here in the individual CSS menu stylesheet are not going to detail here and go through all the styles that  are here or you can go off download the toolkit and look at those examples in detail and determine what it is that you want for your menu  covers one thing to point out is that how we ve created essentially one set of classes to demonstrate how to make our menu looked the way we  want to look in call that the all those styles that CSS adapter menu styles we could create a second set in this cascading style sheet or a  separate cascading style sheets that would implement a different look for a menu so that we could apply one style to a particular menu were set of menus  in our site in the second style to an alternate set of menus on the sites was that flexibility in this model that you can have multiple sets  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=114"&gt;Minute 19&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Of styles to make different menus or in  the case of another control a different grade  etc look different ways so sick look at  the actual webpage your CSS adapter menu aspx  and it s quite simple we don t  have to read sure the any controls your because one very important  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=120"&gt;Minute 20&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Menu CSS and then the individual CSS menu which is our look for the menu one thing to note is that I have been this case put it  in the CSS folder alongside the menu stylesheet we very well could have put this CSS menu over an end at theme folder so it s part of  a theme in our website it away would work down here on line 15 is where we actually implement the menu control in this demo it s getting  its menus data from a data source file which is what the standard went outside Matt and the thing to note here is the new attribute called CSS  selector class and other than that the menu is identical to the standard ASP net menu and you may remember this class or should say this patch food  when we were looking at the VB source code and I pointed out that one of the things that we headed to the initial data fitting contains the entire menu  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=126"&gt;Minute 21&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;A new class attribute that looked at this value in CSS selector class and if you notice the value in CSS selector class is CSS adapter menu  which is what we ve use over here in our cascading style sheet that provides the individual look for this menu so that s the connection between  the stylesheet and the control and what the control will do is they will go off when it renders this and use all of the styles that  are halved the prefix or speak or are of the style CSS adapter menu so it s very important when you clean your stylesheet to follow that  convention and be aware of the fact that that is the link so to speak between the cascading style sheet and your menu control now as I  said a few minutes go on are looking at the CSS menu stylesheet that you could implement two or more input and versions of the styles for the  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=132"&gt;Minute 22&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;You and give them different names are used in many different name in the convention naming for the styles and then it s here when you declare  the menu on the page and you specify what the CSS selector class value is that you would point to one of those alternate styles that you  created in the stylesheet so that s all there is to bring the menu on the page it s pretty simple and is one more important piece  that we need to look at and it s over here and yet browsers folder and what we ve done here is create a browser file plus  open that up and what this does is ASP net when it goes to render the pages looks to see if there are any browser files in  the app_browsers folder and if so depending upon what it tags are inside of these files it does different things for different browsers and other details of the browser file  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=138"&gt;Minute 23&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;You can look up and read about on a road I want to point out one specific thing here in relation to control adapters  with things that you can control in the browser class is for a specific browser can specify which control adapters are active in that  particular browser and you can see here that in order to create that demonstration where we looked at the same page in IE and  Firefox is that I limited the Firefox browser to being the one that actually applies the control adapters including the menu adapter that we  are using so that the Firefox browser rendered the version of the menu using the control adapters CSS approach whereas IE which is not  defined here in the browser file as using the control adapters did not render the CSS version of the menu but the standard table based ASP menu of  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=144"&gt;Minute 24&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Paid off all browsers to use our CSS based menu we would replace the ref ID value here with the Falcons said a Mozilla Firefox and  if we wanted i e you to say for some reason just used the good adapter then we would need a better browser tag here in  the browser file which specified that the control adapter grid would be used for IE etc one thing to note is that this is at the  moment an all or none phenomenon so if you apply a control adapter it is going to be used for all instances of the control in  your website to those role the pieces that we need to implement the CSS control adapter in our own website via the CSS from a DLL  which contains all of the control adapters that we saw over here in the source code project in the opcode code folder here all those who compiled in  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=150"&gt;Minute 25&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;A DLL that we have over here and then we use the browser file to control which type of browser uses various control adapters  we added a cascading stylesheets the standard menu cascading style sheet because we re using the menu control if we were using a grid  view or the detailed list etc we would need to add the appropriate stylesheets here and then link them in to the webpages that  use them as we did hear online nine link in the menu cascading style sheet get a cascading style sheet is an extension of  the base stylesheet for that particular control where you implement the look of the particular control in this case the menu trigger to go  off and download the source code for the CSS control adapter toolkit from complex as well as the assembly and also take a look at that ASP got debts  &lt;br/&gt;&lt;br/&gt;&lt;a href="http://www.mediastoryboard.com/playVideo.aspx?videoID=cp_5&amp;&amp;bookmarkIndex=156"&gt;Minute 26&lt;/a&gt;&lt;br/&gt;&lt;br/&gt;Cache control adapters page as well because there is some good  information there as well as some examples that are helping out  also all of the source code to see in this demo  is available for download accompanying the video so I hope you  will have learned little bit about creating and using CSS control  adapters this is Chris tells from my dead tech com thanks very much for your time  &lt;br/&gt;&lt;br/&gt;&lt;font size='5'&gt;&lt;a href="http://www.asp.net/learn/videos/video-185.aspx"&gt;Click here to go to original video page&lt;/a&gt;&lt;/font&gt;&lt;br/&gt;&lt;br/&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/6610419525310410391-1940462264542282155?l=screencastdirectory.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://screencastdirect
