<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>ASP.NET 2.0 Series</title><link>http://blogs.clearscreen.com/dtax/category/97.aspx</link><description>ASP.NET 2.0 Series</description><managingEditor>Jesús Jiménez</managingEditor><dc:language>es-ES</dc:language><generator>.Text Version 0.95.2004.102</generator><item><dc:creator>Jesús Jiménez</dc:creator><title>WatiN: Web Application Testing in .Net</title><link>http://blogs.clearscreen.com/dtax/archive/2007/01/07/5922.aspx</link><pubDate>Sun, 07 Jan 2007 05:36:00 GMT</pubDate><guid>http://blogs.clearscreen.com/dtax/archive/2007/01/07/5922.aspx</guid><wfw:comment>http://blogs.clearscreen.com/dtax/comments/5922.aspx</wfw:comment><comments>http://blogs.clearscreen.com/dtax/archive/2007/01/07/5922.aspx#Feedback</comments><slash:comments>38</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/dtax/comments/commentRss/5922.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/dtax/services/trackbacks/5922.aspx</trackback:ping><description>&lt;p&gt;&lt;strong&gt;&lt;u&gt;Introduction&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In the project that I'm currently working I need to do an intensive UI and Functional testing to ensure that the application UI is working fine. Due to that I've been looking for a good way to do, both, UI and functional tests. Past week I came across a framework called WatiN and I decided to research about it. This post exposes what I found and I'll try to show you what impressed me of this framework from a developer point of view.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;&lt;br /&gt;What's WatiN?&lt;br /&gt;&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;WatiN stands for Web Application Testing In .Net and enables web applications testing trhought Internet Explorer. WatiN is inspired on WatiR, a web application testing framework for Ruby. The way that WatiN works is very "easy", knowing that there's a lot of work behind a framework like this. WatiN let's you to open Internet Explorer instances and throught interop interact with the elements in the form. With WatiN you can get and set values from the elements in the form and you can fire events of any of the elements in the document too.&lt;br /&gt;&lt;br /&gt;&lt;u&gt;&lt;strong&gt;&lt;br /&gt;Getting started&lt;/strong&gt;&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;The API of WatiN is very nice, at least for me, and watching some code examples and digging a bit you can get benefit of this framework quickly. The first thing that we need to build a test method using WatiN is to add a reference to the WatiN.Core.dll. WatiN gives us four namespaces, furthermore of the one that we use to interact with the IE instances, WatiN.Core. These namespaces are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;WatiN.Core.DialogHandlers: Provides the needed objects to manage dialogs that the browser can show to the user. Some of the handlers you can find in this namespace are for example: AlertDialogHandler, ConfirmDialogHandler, FileUploadDialogHandler, PrintDialogHandler or LogonDialogHandler. 
&lt;/li&gt;&lt;li&gt;WatiN.Core.Exceptions: Provides some specialized exceptions to allow us to control unwanted behaviors. This namespace exceptions examples are: ElementNotFoundException, IENotFoundException, TimeoutException or a generic WatiN exception, WatiNException. 
&lt;/li&gt;&lt;li&gt;WatiN.Core.Interfaces: Provides us some interfaces to extend the WatiN framework, as for example the ILogWriter interface that gives us the availability of implement our own LogWriter class. 
&lt;/li&gt;&lt;li&gt;WatiN.Core.Logging: This namespace exposes some class that will help us in order to log the actions that our test is doing. We can use the DebugLogWriter class to write log messages to the debug window or we can use the Logger class to save our logs in other ways.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Because that the scope of this post is only introductory I'll only show you the usage of the most important objects of the framework. In order to learn more about the rest of the namespaces and/or objects you can check the "References &amp;amp; Resources" section at the bottom of this post.&lt;br /&gt;&lt;br /&gt;Now that we have a brief idea of what WatiN is and what we can do with it, let's write some code to see how is the API's usage.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:b668a055-a999-44c3-8783-e0b87520b3d1" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;&lt;pre style="BACKGROUND-COLOR: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="COLOR: #008080"&gt; 1&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;using&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; WatiN.Core;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 2&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 3&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;[STAThread]
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 4&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;static&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; Main(&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;[] args)
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 5&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;{
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 6&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt; create a new Internet Explorer Instance&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 7&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;    IE ie &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; IE();
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 8&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 9&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt; point it to &lt;/span&gt;&lt;span style="COLOR: #008000; TEXT-DECORATION: underline"&gt;http://www.google.com&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;10&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;    ie.GoTo(&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;http://www.google.com&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;);
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;11&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;12&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt; fill the search box&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;13&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;    ie.TextField(Find.ByName(&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;q&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;)).TypeText(&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;WatiN&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;);
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;14&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;15&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt; performs click event&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;16&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;    ie.Button(Find.ByValue(&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;Google Search&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;)).Click();
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;17&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;The previous code example opens an Internet Explorer instance and points it to &lt;a href="http://www.google.com/"&gt;&lt;font color="#669966"&gt;www.google.com&lt;/font&gt;&lt;/a&gt;, then, when the page is loaded, it searchs a textbox with name "q" and fills it value with the text "WatiN". Then I do the same I did for the textbox but, this time, looking for a button wich value is "Google Search" and then I perform the "Click()" event. If we run this console application we will see an Internet Explorer opening and doing the things we code. Isn't cool?&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;&lt;br /&gt;Solving initial workarounds&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Now just some comments about the above piece of code. In order to automate tasks with Internet Explorer we need to run our test under a thread that has a single-threaded apartment (STA) as apartment state. Notice that over the Main method we have an attribute that makes the thread use STA. A big question that I made myself when I came across this framework was, "And what about running this tests with NUnit?". NUnit doesn't run the tests in a thread using STA apartment state, it uses multithreaded apartment (MTA), but this isn't a big problem so we can attach a config file to NUnit test project and specify the apartment state mode that we want. Let's see how to do it:&lt;br /&gt;&lt;br /&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:953c5e03-597c-4452-b1b5-f64f6d52da73" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;&lt;pre style="BACKGROUND-COLOR: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="COLOR: #008080"&gt; 1&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="COLOR: #ff00ff"&gt;xml version="1.0" encoding="utf-8" &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;?&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 2&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;configuration&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 3&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;configSections&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 4&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;sectionGroup &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;name&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="NUnit"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 5&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;section &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;name&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="TestRunner"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; type&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="System.Configuration.NameValueSectionHandler"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 6&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;sectionGroup&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 7&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;configSections&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 8&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;NUnit&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 9&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;TestRunner&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;10&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;&amp;lt;!--&lt;/span&gt;&lt;span style="COLOR: #008000"&gt; Valid values are STA,MTA. Others ignored. &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;--&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;11&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;add &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;key&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="ApartmentState"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; value&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="STA"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;12&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;TestRunner&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;13&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;NUnit&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;14&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;configuration&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;One thing that will occur after executing the above code is that the Internet Explorer window stills open. If you run more than one test, supposing you use NUnit, you can do two things. First, you can create the instance of the IE object using the "using" keyword and using the constructor that lets us specify the url. If you do that it gets closed and disposed after test execution. Second, you can call the Close() method of the IE instace to programmatically close the window. Both are valid, but I prefer the first one becuase I think that the resulting code is more elegant that if we use the second one.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;&lt;br /&gt;Creating our first UI test&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;If our test result is based on the response that the server sends back to the browser, we can parse the response in order to know if our test has failed or not. The way that we do that is exactly the same that we use to make the test, but searching other items in the page that help us to identify what happend. Suppose that we have an aspx page like this:&lt;br /&gt;&lt;br /&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:007b04c4-8078-4d23-9c48-62933094936b" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;&lt;pre style="BACKGROUND-COLOR: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="COLOR: #008080"&gt; 1&lt;/span&gt; &lt;span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;@ Page Language&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;C#&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; AutoEventWireup&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;true&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; CodeFile&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;Default.aspx.cs&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; Inherits&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;_Default&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; &lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 2&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;!&lt;/span&gt;&lt;span style="COLOR: #ff00ff"&gt;DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 3&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;html &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="http://www.w3.org/1999/xhtml"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 4&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;head &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 5&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;title&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;WatiN Test Page&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;title&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 6&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;head&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 7&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;body&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 8&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;form &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;id&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="form1"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 9&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;h2&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;Check if a nickname is already used&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;h2&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;10&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;table&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;11&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;tr&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;12&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;td&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;Nickname:&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;td&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;13&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;td&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:TextBox &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="txtNickName"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;td&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;14&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;tr&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;15&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;tr&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;16&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;td &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;colspan&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="2"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; align&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="right"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;17&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:Button &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="btnCheck"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; Text&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Check !!"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; OnClick&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="btnCheck_Click"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;18&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;td&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;19&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;tr&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;20&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;tr&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;21&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;td &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;colspan&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="2"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;22&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:Label &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="lblResult"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;23&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;td&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;24&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;tr&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;25&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;table&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;26&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;form&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;27&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;body&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;28&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;html&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;And now suppose that we have this code on the btnCheck.OnClick event:&lt;br /&gt;&lt;br /&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:4ea1a60c-f00b-4166-b33b-4a4fa9f6807c" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;&lt;pre style="BACKGROUND-COLOR: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="COLOR: #008080"&gt;1&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;protected&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; btnCheck_Click(&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;object&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; sender, EventArgs e)
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;2&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;{
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;3&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt; do some logic to check if the nickname is already used.
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;4&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt; i'll return true for all nicknames but "gsus"&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;5&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;if&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; (txtNickName.Text &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;!=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;gsus&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;)
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;6&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        lblResult.Text &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;The nickname is already in use&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;7&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;else&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;8&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        lblResult.Text &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;The nickname is not used&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;9&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;I'm writing this post examples in Visual Studio 2005 and running under Windows Vista, so I don't have Internet Information Services installed. For web development I'm using the ASP.NET Development Server that came with .Net Framework 2.0 so in the next code sample you will see that I start programmatically the Web Server in order to run the test. I'm not a "tests" guru, so I don't really know if my test is the best test of the world, the only thing I'm trying to transmit you is the concept of how it will be done, of course if I'm wrong, your comments are welcome. Now let's see how my test looks finally:&lt;br /&gt;&lt;br /&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:0ada9654-15c4-4eb3-b82d-3cd47d801987" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;&lt;pre style="BACKGROUND-COLOR: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="COLOR: #008080"&gt; 1&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;using&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; System.Diagnostics;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 2&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;using&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; WatiN.Core;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 3&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;using&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; NUnit.Framework;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 4&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;using&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; System;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 5&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 6&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;namespace&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; WebAppUITesting
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 7&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;{
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 8&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    [TestFixture]
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt; 9&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;class&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; UITesting
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;10&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    {
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;11&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;process object &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;12&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;private&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; Process p;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;13&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;14&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        [TestFixtureSetUpAttribute]
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;15&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; SetUp()
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;16&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        {            
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;17&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt; create a new process to start the ASP.Net Development Server&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;18&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;            p &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; Process();
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;19&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;20&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt; set the initial properties &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;21&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; path &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; Environment.CurrentDirectory.Replace(&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;@"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;WebAppUITesting\bin&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;, &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;string&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;.Empty);
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;22&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            p.StartInfo.FileName &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;WebDev.WebServer.EXE&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;23&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            p.StartInfo.Arguments &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; String.Format(&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;/port:8080 /path:\"{0}WebApp\"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;, path);
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;24&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            p.StartInfo.WindowStyle &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; ProcessWindowStyle.Minimized;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;25&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;26&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt; start the process&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;27&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;            p.Start();
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;28&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        }
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;29&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;30&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        [Test]
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;31&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; CheckIfNicknameIsNotUsed()
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;32&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        {
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;33&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt; create a new Internet Explorer instance pointing to the ASP.NET Development Server&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;34&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;using&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; (IE ie &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;new&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; IE(&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;http://localhost:8080/Default.aspx&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;))
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;35&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            {
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;36&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt; Maximize the IE window in order to view test&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;37&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;                ie.ShowWindow(NativeMethods.WindowShowStyle.Maximize);
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;38&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;39&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt; search for txtNickName and type "gsus" in it&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;40&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;                ie.TextField(Find.ById(&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;txtNickName&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;)).TypeText(&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;gsus&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;);
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;41&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;42&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt; fire the click event of the button&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;43&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;                ie.Button(Find.ById(&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;btnCheck&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;)).Click();
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;44&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;45&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt; parse the response in order to fail the test or not &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;46&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;                Assert.AreEqual(&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;true&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;, ie.ContainsText(&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;The nickname is not used&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;));
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;47&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            }            
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;48&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        }
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;49&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;50&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        [TestFixtureTearDownAttribute]
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;51&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;public&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;void&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; TearDown()
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;52&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        {
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;53&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt; kill the ASP.NET Development Server process&lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;54&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;            p.Kill();
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;55&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        }
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;56&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    }
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;57&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;As you can see I use the method ContainsText in line 46. This method searchs the specified text in the document content and returns a bool indicating if there are occurrences in the search. We can replace the line 46 with the next code example, where I directly get the "lblResult" span content to see if the nickname is already used:&lt;br /&gt;&lt;br /&gt;
&lt;p&gt;&lt;/p&gt;
&lt;div class="wlWriterEditableSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:23037fa2-b052-444e-b6ce-a69bb5a8fda3" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"&gt;&lt;pre style="BACKGROUND-COLOR: white"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="COLOR: #008080"&gt;1&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;//&lt;/span&gt;&lt;span style="COLOR: #008000"&gt; parse the response in order to fail the test or not &lt;/span&gt;&lt;span style="COLOR: #008000"&gt;
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;2&lt;/span&gt; &lt;span style="COLOR: #008000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;bool&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; result &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; (ie.Span(Find.ById(&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;lblResult&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;)).Text &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;==&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;The nickname is not used&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;);
&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;3&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;Assert.AreEqual(&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;true&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;, result);&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;/div&gt;&lt;strong&gt;&lt;u&gt;&lt;br /&gt;&lt;br /&gt;Conclusion&lt;/u&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;At this point, you should know how to basically use WatiN framework to test your web applications. I hope you find this framework and this post useful as I did. Personally I haven't used any other web application testing framework but I get really surprised with how we can test our UI using WatiN. I think that we can do an intesive UI and functional testing with it.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;u&gt;&lt;br /&gt;References &amp;amp; Resources&lt;/u&gt;&lt;/strong&gt; 
&lt;p&gt;References:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;WatiN Homepage: &lt;a href="http://watin.sourceforge.net/"&gt;&lt;font color="#669966"&gt;http://watin.sourceforge.net/&lt;/font&gt;&lt;/a&gt; 
&lt;/li&gt;&lt;li&gt;WatiN MSDN style documentation: &lt;a href="http://watin.sourceforge.net/doc/index.html"&gt;&lt;font color="#669966"&gt;http://watin.sourceforge.net/doc/index.html&lt;/font&gt;&lt;/a&gt; 
&lt;/li&gt;&lt;li&gt;WatiN Getting Started: &lt;a href="http://watin.sourceforge.net/gettingstarted.html"&gt;&lt;font color="#669966"&gt;http://watin.sourceforge.net/gettingstarted.html&lt;/font&gt;&lt;/a&gt; 
&lt;/li&gt;&lt;li&gt;WatiN and ApartmentState: &lt;a href="http://watin.sourceforge.net/apartmentstateinfo.ht..."&gt;&lt;font color="#669966"&gt;http://watin.sourceforge.net/apartmentstateinfo.ht...&lt;/font&gt;&lt;/a&gt; 
&lt;/li&gt;&lt;li&gt;WatiR (Web Application Testing in Ruby): &lt;a href="http://wtr.rubyforge.org/"&gt;&lt;font color="#669966"&gt;http://wtr.rubyforge.org/&lt;/font&gt;&lt;/a&gt; 
&lt;/li&gt;&lt;li&gt;ASP.NET Development Server: &lt;a href="http://msdn2.microsoft.com/en-us/library/58wxa9w5(VS.80).aspx"&gt;&lt;font color="#669966"&gt;http://msdn2.microsoft.com/en-us/library/58wxa9w5(...&lt;/font&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;Resources:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;WatiN Framework for .Net 1.1: &lt;a href="http://downloads.sourceforge.net/watin/WatiN-0.9.5.4000-net-1.1.zip?modtime=1167604846&amp;amp;big_mirror=0"&gt;&lt;font color="#669966"&gt;WatiN-0.9.5.4000-net-1.1.zip&lt;/font&gt;&lt;/a&gt; 
&lt;/li&gt;&lt;li&gt;WatiN Framework for .Net 2.0: &lt;a href="http://downloads.sourceforge.net/watin/WatiN-0.9.5.4000-net-2.0.zip?modtime=1167604860&amp;amp;big_mirror=0"&gt;&lt;font color="#669966"&gt;WatiN-0.9.5.4000-net-2.0.zip&lt;/font&gt;&lt;/a&gt; 
&lt;/li&gt;&lt;li&gt;This post examples source code: &lt;a href="http://blogs.clearscreen.com/dtax/files/WatiN_Examples.zip"&gt;&lt;font color="#669966"&gt;http://blogs.clearscreen.com/dtax/files/WatiN_Examples.zip&lt;/font&gt;&lt;/a&gt; &lt;/li&gt;&lt;/ul&gt;&lt;img src ="http://blogs.clearscreen.com/dtax/aggbug/5922.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p><strong><u>Introduction</u></strong><br /><br />In the project that I'm currently working I need to do an intensive UI and Functional testing to ensure that the application UI is working fine. Due to that I've been looking for a good way to do, both, UI and functional tests. Past week I came across a framework called WatiN and I decided to research about it. This post exposes what I found and I'll try to show you what impressed me of this framework from a developer point of view.<br /><br /><strong><u><br />What's WatiN?<br /></u></strong><br />WatiN stands for Web Application Testing In .Net and enables web applications testing trhought Internet Explorer. WatiN is inspired on WatiR, a web application testing framework for Ruby. The way that WatiN works is very "easy", knowing that there's a lot of work behind a framework like this. WatiN let's you to open Internet Explorer instances and throught interop interact with the elements in the form. With WatiN you can get and set values from the elements in the form and you can fire events of any of the elements in the document too.<br /><br /><u><strong><br />Getting started</strong></u><br /><br />The API of WatiN is very nice, at least for me, and watching some code examples and digging a bit you can get benefit of this framework quickly. The first thing that we need to build a test method using WatiN is to add a reference to the WatiN.Core.dll. WatiN gives us four namespaces, furthermore of the one that we use to interact with the IE instances, WatiN.Core. These namespaces are:</p>
<ul>
<li>WatiN.Core.DialogHandlers: Provides the needed objects to manage dialogs that the browser can show to the user. Some of the handlers you can find in this namespace are for example: AlertDialogHandler, ConfirmDialogHandler, FileUploadDialogHandler, PrintDialogHandler or LogonDialogHandler. 
</li><li>WatiN.Core.Exceptions: Provides some specialized exceptions to allow us to control unwanted behaviors. This namespace exceptions examples are: ElementNotFoundException, IENotFoundException, TimeoutException or a generic WatiN exception, WatiNException. 
</li><li>WatiN.Core.Interfaces: Provides us some interfaces to extend the WatiN framework, as for example the ILogWriter interface that gives us the availability of implement our own LogWriter class. 
</li><li>WatiN.Core.Logging: This namespace exposes some class that will help us in order to log the actions that our test is doing. We can use the DebugLogWriter class to write log messages to the debug window or we can use the Logger class to save our logs in other ways.</li></ul>
<p>Because that the scope of this post is only introductory I'll only show you the usage of the most important objects of the framework. In order to learn more about the rest of the namespaces and/or objects you can check the "References &amp; Resources" section at the bottom of this post.<br /><br />Now that we have a brief idea of what WatiN is and what we can do with it, let's write some code to see how is the API's usage.</p>
<p></p>
<p></p>
<div class="wlWriterEditableSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:b668a055-a999-44c3-8783-e0b87520b3d1" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"><pre style="BACKGROUND-COLOR: white"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="COLOR: #008080"> 1</span> <span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> WatiN.Core;
</span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #000000">[STAThread]
</span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">static</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> Main(</span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">[] args)
</span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000">{
</span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000">    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> create a new Internet Explorer Instance</span><span style="COLOR: #008000">
</span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">    IE ie </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> IE();
</span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000">    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> point it to </span><span style="COLOR: #008000; TEXT-DECORATION: underline">http://www.google.com</span><span style="COLOR: #008000">
</span><span style="COLOR: #008080">10</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">    ie.GoTo(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">http://www.google.com</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);
</span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">
</span><span style="COLOR: #008080">12</span> <span style="COLOR: #000000">    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> fill the search box</span><span style="COLOR: #008000">
</span><span style="COLOR: #008080">13</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">    ie.TextField(Find.ByName(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">q</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)).TypeText(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">WatiN</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);
</span><span style="COLOR: #008080">14</span> <span style="COLOR: #000000">
</span><span style="COLOR: #008080">15</span> <span style="COLOR: #000000">    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> performs click event</span><span style="COLOR: #008000">
</span><span style="COLOR: #008080">16</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">    ie.Button(Find.ByValue(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">Google Search</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)).Click();
</span><span style="COLOR: #008080">17</span> <span style="COLOR: #000000">}</span></div></pre></div><br />The previous code example opens an Internet Explorer instance and points it to <a href="http://www.google.com/"><font color="#669966">www.google.com</font></a>, then, when the page is loaded, it searchs a textbox with name "q" and fills it value with the text "WatiN". Then I do the same I did for the textbox but, this time, looking for a button wich value is "Google Search" and then I perform the "Click()" event. If we run this console application we will see an Internet Explorer opening and doing the things we code. Isn't cool?<br /><br /><strong><u><br />Solving initial workarounds</u></strong><br /><br />Now just some comments about the above piece of code. In order to automate tasks with Internet Explorer we need to run our test under a thread that has a single-threaded apartment (STA) as apartment state. Notice that over the Main method we have an attribute that makes the thread use STA. A big question that I made myself when I came across this framework was, "And what about running this tests with NUnit?". NUnit doesn't run the tests in a thread using STA apartment state, it uses multithreaded apartment (MTA), but this isn't a big problem so we can attach a config file to NUnit test project and specify the apartment state mode that we want. Let's see how to do it:<br /><br />
<p></p>
<div class="wlWriterEditableSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:953c5e03-597c-4452-b1b5-f64f6d52da73" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"><pre style="BACKGROUND-COLOR: white"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="COLOR: #008080"> 1</span> <span style="COLOR: #0000ff">&lt;?</span><span style="COLOR: #ff00ff">xml version="1.0" encoding="utf-8" </span><span style="COLOR: #0000ff">?&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">configuration</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">configSections</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">sectionGroup </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="NUnit"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">section </span><span style="COLOR: #ff0000">name</span><span style="COLOR: #0000ff">="TestRunner"</span><span style="COLOR: #ff0000"> type</span><span style="COLOR: #0000ff">="System.Configuration.NameValueSectionHandler"</span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">sectionGroup</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">configSections</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">NUnit</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">TestRunner</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000">            </span><span style="COLOR: #008000">&lt;!--</span><span style="COLOR: #008000"> Valid values are STA,MTA. Others ignored. </span><span style="COLOR: #008000">--&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">add </span><span style="COLOR: #ff0000">key</span><span style="COLOR: #0000ff">="ApartmentState"</span><span style="COLOR: #ff0000"> value</span><span style="COLOR: #0000ff">="STA"</span><span style="COLOR: #ff0000"> </span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">12</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">TestRunner</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">13</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">NUnit</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">14</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">configuration</span><span style="COLOR: #0000ff">&gt;</span></div></pre></div><br />One thing that will occur after executing the above code is that the Internet Explorer window stills open. If you run more than one test, supposing you use NUnit, you can do two things. First, you can create the instance of the IE object using the "using" keyword and using the constructor that lets us specify the url. If you do that it gets closed and disposed after test execution. Second, you can call the Close() method of the IE instace to programmatically close the window. Both are valid, but I prefer the first one becuase I think that the resulting code is more elegant that if we use the second one.<br /><br /><strong><u><br />Creating our first UI test</u></strong><br /><br />If our test result is based on the response that the server sends back to the browser, we can parse the response in order to know if our test has failed or not. The way that we do that is exactly the same that we use to make the test, but searching other items in the page that help us to identify what happend. Suppose that we have an aspx page like this:<br /><br />
<p></p>
<div class="wlWriterEditableSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:007b04c4-8078-4d23-9c48-62933094936b" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"><pre style="BACKGROUND-COLOR: white"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="COLOR: #008080"> 1</span> <span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">@ Page Language</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">C#</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> AutoEventWireup</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">true</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> CodeFile</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">Default.aspx.cs</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> Inherits</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">_Default</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">html </span><span style="COLOR: #ff0000">xmlns</span><span style="COLOR: #0000ff">="http://www.w3.org/1999/xhtml"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">head </span><span style="COLOR: #ff0000">runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">WatiN Test Page</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">form </span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="form1"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">h2</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Check if a nickname is already used</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">h2</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">table</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">12</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Nickname:</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">13</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">asp:TextBox </span><span style="COLOR: #ff0000">runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> ID</span><span style="COLOR: #0000ff">="txtNickName"</span><span style="COLOR: #ff0000"> </span><span style="COLOR: #0000ff">/&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">14</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">15</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">16</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td </span><span style="COLOR: #ff0000">colspan</span><span style="COLOR: #0000ff">="2"</span><span style="COLOR: #ff0000"> align</span><span style="COLOR: #0000ff">="right"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">17</span> <span style="COLOR: #000000">                    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:Button </span><span style="COLOR: #ff0000">runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> ID</span><span style="COLOR: #0000ff">="btnCheck"</span><span style="COLOR: #ff0000"> Text</span><span style="COLOR: #0000ff">="Check !!"</span><span style="COLOR: #ff0000"> OnClick</span><span style="COLOR: #0000ff">="btnCheck_Click"</span><span style="COLOR: #ff0000"> </span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">18</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">19</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">20</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">21</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td </span><span style="COLOR: #ff0000">colspan</span><span style="COLOR: #0000ff">="2"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">22</span> <span style="COLOR: #000000">                    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:Label </span><span style="COLOR: #ff0000">runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> ID</span><span style="COLOR: #0000ff">="lblResult"</span><span style="COLOR: #ff0000"> </span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">23</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">24</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">25</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">table</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">26</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">form</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">27</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">28</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span></div></pre></div><br />And now suppose that we have this code on the btnCheck.OnClick event:<br /><br />
<p></p>
<div class="wlWriterEditableSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:4ea1a60c-f00b-4166-b33b-4a4fa9f6807c" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"><pre style="BACKGROUND-COLOR: white"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="COLOR: #008080">1</span> <span style="COLOR: #0000ff">protected</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> btnCheck_Click(</span><span style="COLOR: #0000ff">object</span><span style="COLOR: #000000"> sender, EventArgs e)
</span><span style="COLOR: #008080">2</span> <span style="COLOR: #000000">{
</span><span style="COLOR: #008080">3</span> <span style="COLOR: #000000">    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> do some logic to check if the nickname is already used.
</span><span style="COLOR: #008080">4</span> <span style="COLOR: #008000">    </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> i'll return true for all nicknames but "gsus"</span><span style="COLOR: #008000">
</span><span style="COLOR: #008080">5</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">if</span><span style="COLOR: #000000"> (txtNickName.Text </span><span style="COLOR: #000000">!=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">gsus</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)
</span><span style="COLOR: #008080">6</span> <span style="COLOR: #000000">        lblResult.Text </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">The nickname is already in use</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;
</span><span style="COLOR: #008080">7</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">else</span><span style="COLOR: #000000">
</span><span style="COLOR: #008080">8</span> <span style="COLOR: #000000">        lblResult.Text </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">The nickname is not used</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;
</span><span style="COLOR: #008080">9</span> <span style="COLOR: #000000">}</span></div></pre></div><br />I'm writing this post examples in Visual Studio 2005 and running under Windows Vista, so I don't have Internet Information Services installed. For web development I'm using the ASP.NET Development Server that came with .Net Framework 2.0 so in the next code sample you will see that I start programmatically the Web Server in order to run the test. I'm not a "tests" guru, so I don't really know if my test is the best test of the world, the only thing I'm trying to transmit you is the concept of how it will be done, of course if I'm wrong, your comments are welcome. Now let's see how my test looks finally:<br /><br />
<p></p>
<p></p>
<div class="wlWriterEditableSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:0ada9654-15c4-4eb3-b82d-3cd47d801987" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"><pre style="BACKGROUND-COLOR: white"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="COLOR: #008080"> 1</span> <span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> System.Diagnostics;
</span><span style="COLOR: #008080"> 2</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> WatiN.Core;
</span><span style="COLOR: #008080"> 3</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> NUnit.Framework;
</span><span style="COLOR: #008080"> 4</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> System;
</span><span style="COLOR: #008080"> 5</span> <span style="COLOR: #000000">
</span><span style="COLOR: #008080"> 6</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">namespace</span><span style="COLOR: #000000"> WebAppUITesting
</span><span style="COLOR: #008080"> 7</span> <span style="COLOR: #000000">{
</span><span style="COLOR: #008080"> 8</span> <span style="COLOR: #000000">    [TestFixture]
</span><span style="COLOR: #008080"> 9</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">class</span><span style="COLOR: #000000"> UITesting
</span><span style="COLOR: #008080">10</span> <span style="COLOR: #000000">    {
</span><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">        </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000">process object </span><span style="COLOR: #008000">
</span><span style="COLOR: #008080">12</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">private</span><span style="COLOR: #000000"> Process p;
</span><span style="COLOR: #008080">13</span> <span style="COLOR: #000000">
</span><span style="COLOR: #008080">14</span> <span style="COLOR: #000000">        [TestFixtureSetUpAttribute]
</span><span style="COLOR: #008080">15</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> SetUp()
</span><span style="COLOR: #008080">16</span> <span style="COLOR: #000000">        {            
</span><span style="COLOR: #008080">17</span> <span style="COLOR: #000000">            </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> create a new process to start the ASP.Net Development Server</span><span style="COLOR: #008000">
</span><span style="COLOR: #008080">18</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">            p </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> Process();
</span><span style="COLOR: #008080">19</span> <span style="COLOR: #000000">
</span><span style="COLOR: #008080">20</span> <span style="COLOR: #000000">            </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> set the initial properties </span><span style="COLOR: #008000">
</span><span style="COLOR: #008080">21</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000"> path </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> Environment.CurrentDirectory.Replace(</span><span style="COLOR: #000000">@"</span><span style="COLOR: #000000">WebAppUITesting\bin</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, </span><span style="COLOR: #0000ff">string</span><span style="COLOR: #000000">.Empty);
</span><span style="COLOR: #008080">22</span> <span style="COLOR: #000000">            p.StartInfo.FileName </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">WebDev.WebServer.EXE</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">;
</span><span style="COLOR: #008080">23</span> <span style="COLOR: #000000">            p.StartInfo.Arguments </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> String.Format(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">/port:8080 /path:\"{0}WebApp\"</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">, path);
</span><span style="COLOR: #008080">24</span> <span style="COLOR: #000000">            p.StartInfo.WindowStyle </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> ProcessWindowStyle.Minimized;
</span><span style="COLOR: #008080">25</span> <span style="COLOR: #000000">
</span><span style="COLOR: #008080">26</span> <span style="COLOR: #000000">            </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> start the process</span><span style="COLOR: #008000">
</span><span style="COLOR: #008080">27</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">            p.Start();
</span><span style="COLOR: #008080">28</span> <span style="COLOR: #000000">        }
</span><span style="COLOR: #008080">29</span> <span style="COLOR: #000000">
</span><span style="COLOR: #008080">30</span> <span style="COLOR: #000000">        [Test]
</span><span style="COLOR: #008080">31</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> CheckIfNicknameIsNotUsed()
</span><span style="COLOR: #008080">32</span> <span style="COLOR: #000000">        {
</span><span style="COLOR: #008080">33</span> <span style="COLOR: #000000">            </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> create a new Internet Explorer instance pointing to the ASP.NET Development Server</span><span style="COLOR: #008000">
</span><span style="COLOR: #008080">34</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">using</span><span style="COLOR: #000000"> (IE ie </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">new</span><span style="COLOR: #000000"> IE(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">http://localhost:8080/Default.aspx</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">))
</span><span style="COLOR: #008080">35</span> <span style="COLOR: #000000">            {
</span><span style="COLOR: #008080">36</span> <span style="COLOR: #000000">                </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> Maximize the IE window in order to view test</span><span style="COLOR: #008000">
</span><span style="COLOR: #008080">37</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">                ie.ShowWindow(NativeMethods.WindowShowStyle.Maximize);
</span><span style="COLOR: #008080">38</span> <span style="COLOR: #000000">
</span><span style="COLOR: #008080">39</span> <span style="COLOR: #000000">                </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> search for txtNickName and type "gsus" in it</span><span style="COLOR: #008000">
</span><span style="COLOR: #008080">40</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">                ie.TextField(Find.ById(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">txtNickName</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)).TypeText(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">gsus</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);
</span><span style="COLOR: #008080">41</span> <span style="COLOR: #000000">
</span><span style="COLOR: #008080">42</span> <span style="COLOR: #000000">                </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> fire the click event of the button</span><span style="COLOR: #008000">
</span><span style="COLOR: #008080">43</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">                ie.Button(Find.ById(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">btnCheck</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)).Click();
</span><span style="COLOR: #008080">44</span> <span style="COLOR: #000000">
</span><span style="COLOR: #008080">45</span> <span style="COLOR: #000000">                </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> parse the response in order to fail the test or not </span><span style="COLOR: #008000">
</span><span style="COLOR: #008080">46</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">                Assert.AreEqual(</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">, ie.ContainsText(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">The nickname is not used</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">));
</span><span style="COLOR: #008080">47</span> <span style="COLOR: #000000">            }            
</span><span style="COLOR: #008080">48</span> <span style="COLOR: #000000">        }
</span><span style="COLOR: #008080">49</span> <span style="COLOR: #000000">
</span><span style="COLOR: #008080">50</span> <span style="COLOR: #000000">        [TestFixtureTearDownAttribute]
</span><span style="COLOR: #008080">51</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">public</span><span style="COLOR: #000000"> </span><span style="COLOR: #0000ff">void</span><span style="COLOR: #000000"> TearDown()
</span><span style="COLOR: #008080">52</span> <span style="COLOR: #000000">        {
</span><span style="COLOR: #008080">53</span> <span style="COLOR: #000000">            </span><span style="COLOR: #008000">//</span><span style="COLOR: #008000"> kill the ASP.NET Development Server process</span><span style="COLOR: #008000">
</span><span style="COLOR: #008080">54</span> <span style="COLOR: #008000"></span><span style="COLOR: #000000">            p.Kill();
</span><span style="COLOR: #008080">55</span> <span style="COLOR: #000000">        }
</span><span style="COLOR: #008080">56</span> <span style="COLOR: #000000">    }
</span><span style="COLOR: #008080">57</span> <span style="COLOR: #000000">}</span></div></pre></div><br />As you can see I use the method ContainsText in line 46. This method searchs the specified text in the document content and returns a bool indicating if there are occurrences in the search. We can replace the line 46 with the next code example, where I directly get the "lblResult" span content to see if the nickname is already used:<br /><br />
<p></p>
<div class="wlWriterEditableSmartContent" id="57F11A72-B0E5-49c7-9094-E3A15BD5B5E7:23037fa2-b052-444e-b6ce-a69bb5a8fda3" contenteditable="false" style="PADDING-RIGHT: 0px; DISPLAY: inline; PADDING-LEFT: 0px; FLOAT: none; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px"><pre style="BACKGROUND-COLOR: white"><div><!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--><span style="COLOR: #008080">1</span> <span style="COLOR: #008000">//</span><span style="COLOR: #008000"> parse the response in order to fail the test or not </span><span style="COLOR: #008000">
</span><span style="COLOR: #008080">2</span> <span style="COLOR: #008000"></span><span style="COLOR: #0000ff">bool</span><span style="COLOR: #000000"> result </span><span style="COLOR: #000000">=</span><span style="COLOR: #000000"> (ie.Span(Find.ById(</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">lblResult</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">)).Text </span><span style="COLOR: #000000">==</span><span style="COLOR: #000000"> </span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">The nickname is not used</span><span style="COLOR: #000000">"</span><span style="COLOR: #000000">);
</span><span style="COLOR: #008080">3</span> <span style="COLOR: #000000">Assert.AreEqual(</span><span style="COLOR: #0000ff">true</span><span style="COLOR: #000000">, result);</span></div></pre></div><strong><u><br /><br />Conclusion</u></strong><br /><br />At this point, you should know how to basically use WatiN framework to test your web applications. I hope you find this framework and this post useful as I did. Personally I haven't used any other web application testing framework but I get really surprised with how we can test our UI using WatiN. I think that we can do an intesive UI and functional testing with it.<br /><br /><strong><u><br />References &amp; Resources</u></strong> 
<p>References:</p>
<ul>
<li>WatiN Homepage: <a href="http://watin.sourceforge.net/"><font color="#669966">http://watin.sourceforge.net/</font></a> 
</li><li>WatiN MSDN style documentation: <a href="http://watin.sourceforge.net/doc/index.html"><font color="#669966">http://watin.sourceforge.net/doc/index.html</font></a> 
</li><li>WatiN Getting Started: <a href="http://watin.sourceforge.net/gettingstarted.html"><font color="#669966">http://watin.sourceforge.net/gettingstarted.html</font></a> 
</li><li>WatiN and ApartmentState: <a href="http://watin.sourceforge.net/apartmentstateinfo.ht..."><font color="#669966">http://watin.sourceforge.net/apartmentstateinfo.ht...</font></a> 
</li><li>WatiR (Web Application Testing in Ruby): <a href="http://wtr.rubyforge.org/"><font color="#669966">http://wtr.rubyforge.org/</font></a> 
</li><li>ASP.NET Development Server: <a href="http://msdn2.microsoft.com/en-us/library/58wxa9w5(VS.80).aspx"><font color="#669966">http://msdn2.microsoft.com/en-us/library/58wxa9w5(...</font></a></li></ul>
<p>Resources:</p>
<ul>
<li>WatiN Framework for .Net 1.1: <a href="http://downloads.sourceforge.net/watin/WatiN-0.9.5.4000-net-1.1.zip?modtime=1167604846&amp;big_mirror=0"><font color="#669966">WatiN-0.9.5.4000-net-1.1.zip</font></a> 
</li><li>WatiN Framework for .Net 2.0: <a href="http://downloads.sourceforge.net/watin/WatiN-0.9.5.4000-net-2.0.zip?modtime=1167604860&amp;big_mirror=0"><font color="#669966">WatiN-0.9.5.4000-net-2.0.zip</font></a> 
</li><li>This post examples source code: <a href="http://blogs.clearscreen.com/dtax/files/WatiN_Examples.zip"><font color="#669966">http://blogs.clearscreen.com/dtax/files/WatiN_Examples.zip</font></a> </li></ul><img src ="http://blogs.clearscreen.com/dtax/aggbug/5922.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Jesús Jiménez</dc:creator><title>Security How Tos</title><link>http://blogs.clearscreen.com/dtax/archive/2006/02/25/2855.aspx</link><pubDate>Sat, 25 Feb 2006 12:20:00 GMT</pubDate><guid>http://blogs.clearscreen.com/dtax/archive/2006/02/25/2855.aspx</guid><wfw:comment>http://blogs.clearscreen.com/dtax/comments/2855.aspx</wfw:comment><comments>http://blogs.clearscreen.com/dtax/archive/2006/02/25/2855.aspx#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/dtax/comments/commentRss/2855.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/dtax/services/trackbacks/2855.aspx</trackback:ping><description>&lt;p&gt;Patterns &amp;amp; Pratices has very good Security How Tos articles most of them rated 9 of 9. The topics of this articles applies to a lot of  issues that surely got crazy many of you (and me). Take a look at: &lt;a href="http://msdn.microsoft.com/library/en-us/dnpag2/html/SecurityHowTosIndex.asp?frame=true"&gt;http://msdn.microsoft.com/library/en-us/dnpag2/html/SecurityHowTosIndex.asp?frame=true&lt;/a&gt;&lt;/p&gt;&lt;img src ="http://blogs.clearscreen.com/dtax/aggbug/2855.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>Patterns &amp; Pratices has very good Security How Tos articles most of them rated 9 of 9. The topics of this articles applies to a lot of  issues that surely got crazy many of you (and me). Take a look at: <a href="http://msdn.microsoft.com/library/en-us/dnpag2/html/SecurityHowTosIndex.asp?frame=true">http://msdn.microsoft.com/library/en-us/dnpag2/html/SecurityHowTosIndex.asp?frame=true</a></p><img src ="http://blogs.clearscreen.com/dtax/aggbug/2855.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Jesús Jiménez</dc:creator><title>70-528 -&gt; Passed !! :D</title><link>http://blogs.clearscreen.com/dtax/archive/2006/02/17/2819.aspx</link><pubDate>Fri, 17 Feb 2006 08:32:00 GMT</pubDate><guid>http://blogs.clearscreen.com/dtax/archive/2006/02/17/2819.aspx</guid><wfw:comment>http://blogs.clearscreen.com/dtax/comments/2819.aspx</wfw:comment><comments>http://blogs.clearscreen.com/dtax/archive/2006/02/17/2819.aspx#Feedback</comments><slash:comments>51</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/dtax/comments/commentRss/2819.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/dtax/services/trackbacks/2819.aspx</trackback:ping><description>&lt;p&gt;November 11th, was the day that I took the Beta exam 70-528 - TS: Microsoft .NET Framework 2.0 - Web-Based Client Development. Days after I took it I wrote my &lt;a href="http://blogs.clearscreen.com/dtax/archive/2005/11/14/2563.aspx"&gt;personal review of the exam&lt;/a&gt; and early this morning I checked if I passed it. As you can imagine(and as you can read in this post's title) I passed it!!&lt;/p&gt;&lt;img src ="http://blogs.clearscreen.com/dtax/aggbug/2819.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>November 11th, was the day that I took the Beta exam 70-528 - TS: Microsoft .NET Framework 2.0 - Web-Based Client Development. Days after I took it I wrote my <a href="http://blogs.clearscreen.com/dtax/archive/2005/11/14/2563.aspx">personal review of the exam</a> and early this morning I checked if I passed it. As you can imagine(and as you can read in this post's title) I passed it!!</p><img src ="http://blogs.clearscreen.com/dtax/aggbug/2819.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Jesús Jiménez</dc:creator><title>¿Cuanto sabes de Visual Studio 2005 y SQL Server 2005?</title><link>http://blogs.clearscreen.com/dtax/archive/2005/06/08/1873.aspx</link><pubDate>Wed, 08 Jun 2005 12:47:00 GMT</pubDate><guid>http://blogs.clearscreen.com/dtax/archive/2005/06/08/1873.aspx</guid><wfw:comment>http://blogs.clearscreen.com/dtax/comments/1873.aspx</wfw:comment><comments>http://blogs.clearscreen.com/dtax/archive/2005/06/08/1873.aspx#Feedback</comments><slash:comments>4</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/dtax/comments/commentRss/1873.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/dtax/services/trackbacks/1873.aspx</trackback:ping><description>&lt;p&gt;Ayer vi que en la MSDN, en el apartado de Learning, hay una serie de tests para medir tu conocimiento sobre distintas materias. Estos tests son clavados (en estilo) a las certificaciones y aparte de tests sobre Windows XP, Windows 2003, SQL Server, Exchange Server, Seguridad, Visual Studio 2003 y otros temas, curiosamente hay de &lt;a href="http://assessment.learning.microsoft.com/test/home.asp#15"&gt;Visual Studio 2005&lt;/a&gt;  con dos tests y de &lt;a href="http://assessment.learning.microsoft.com/test/home.asp#14"&gt;SQL Server 2005&lt;/a&gt; con tres tests.&lt;br /&gt;&lt;br /&gt;· What's New in Microsoft® Visual Studio® 2005&lt;br /&gt;· What's New in ASP.NET 2.0&lt;br /&gt;· Introducing Microsoft® SQL Server™ 2005 for Database Administrators&lt;br /&gt;· Introducing Microsoft® SQL Server™ 2005 for Database Developers&lt;br /&gt;· Introducing Microsoft® SQL Server™ 2005 for Business Intelligence Developers&lt;br /&gt;&lt;br /&gt;Yo hice el de ASP.NET 2.0 y saque un mediocre 60%, aunque teniendo en cuenta que aún no me he peleado en un proyecto real con esta tecnología no esta nada mal. Lo que me parecio bastante bien es que hacen "estudio" personalizado de que deberias reforzar según tu resultado del test y te indican que MOCs incluyen el temario que necesitas.&lt;/p&gt;&lt;img src ="http://blogs.clearscreen.com/dtax/aggbug/1873.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>Ayer vi que en la MSDN, en el apartado de Learning, hay una serie de tests para medir tu conocimiento sobre distintas materias. Estos tests son clavados (en estilo) a las certificaciones y aparte de tests sobre Windows XP, Windows 2003, SQL Server, Exchange Server, Seguridad, Visual Studio 2003 y otros temas, curiosamente hay de <a href="http://assessment.learning.microsoft.com/test/home.asp#15">Visual Studio 2005</a>  con dos tests y de <a href="http://assessment.learning.microsoft.com/test/home.asp#14">SQL Server 2005</a> con tres tests.<br /><br />· What's New in Microsoft® Visual Studio® 2005<br />· What's New in ASP.NET 2.0<br />· Introducing Microsoft® SQL Server™ 2005 for Database Administrators<br />· Introducing Microsoft® SQL Server™ 2005 for Database Developers<br />· Introducing Microsoft® SQL Server™ 2005 for Business Intelligence Developers<br /><br />Yo hice el de ASP.NET 2.0 y saque un mediocre 60%, aunque teniendo en cuenta que aún no me he peleado en un proyecto real con esta tecnología no esta nada mal. Lo que me parecio bastante bien es que hacen "estudio" personalizado de que deberias reforzar según tu resultado del test y te indican que MOCs incluyen el temario que necesitas.</p><img src ="http://blogs.clearscreen.com/dtax/aggbug/1873.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Jesús Jiménez</dc:creator><title>ASP.NET 2.0 Series: Default Button</title><link>http://blogs.clearscreen.com/dtax/archive/2005/04/10/1341.aspx</link><pubDate>Sun, 10 Apr 2005 17:54:00 GMT</pubDate><guid>http://blogs.clearscreen.com/dtax/archive/2005/04/10/1341.aspx</guid><wfw:comment>http://blogs.clearscreen.com/dtax/comments/1341.aspx</wfw:comment><comments>http://blogs.clearscreen.com/dtax/archive/2005/04/10/1341.aspx#Feedback</comments><slash:comments>17</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/dtax/comments/commentRss/1341.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/dtax/services/trackbacks/1341.aspx</trackback:ping><description>&lt;p&gt;Otra de las pequeñas funcionalidades que nos ofrece ASP.NET 2.0 es la de asignar botones por defecto para un formulario cuando se pulsa la tecla ENTER.&lt;/p&gt;
&lt;p&gt;Esta funcionalidad se podía conseguir añadiendo una función bastante sencillita de JavaScript en nuestras páginas de ASP.NET 1.0 ó 1.1, pero ahora simplemente es una propiedad más del tag FORM o incluso podemos definir un botón por defecto para un Panel.&lt;/p&gt;
&lt;p&gt;Ahora cuando pulsamos la tecla ENTER en una página de ASP.NET 2.0 se dispara el evento del primer botón que haya en el formulario a menos que hayamos indicado mediante la propiedad DefaultButton de la etiqueta FORM que botón queremos que sea el botón por defecto.&lt;/p&gt;
&lt;p&gt;Pero si en nuestro formulario tenemos más de un botón  y desde una zona determinada de nuestro formulario queremos que se dispare un evento de un botón diferente al del resto del formulario también tenemos la propiedad DefaultButton en el control Panel.&lt;/p&gt;
&lt;p&gt;Y como en otros posts de esta serie, un ejemplo para que veáis como funciona esto:&lt;br /&gt;&lt;br /&gt;
&lt;/p&gt;&lt;div&gt;&lt;!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--&gt;&lt;span style="COLOR: #008080"&gt;1&lt;/span&gt; &lt;span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;@ Page Language&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;C#&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; CodeFile&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;Default.aspx.cs&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; Inherits&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;Default_aspx&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; &lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;2&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;!&lt;/span&gt;&lt;span style="COLOR: #ff00ff"&gt;DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;3&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;html &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="http://www.w3.org/1999/xhtml"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;4&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;head &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;5&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;title&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;Ejemplo de Default Button&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;title&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;6&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;head&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;7&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;body&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;8&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #008080"&gt;1&lt;/span&gt; &lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;form &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;id&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="form1"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; defaultbutton&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="btnBuscar"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span style="COLOR: #008080"&gt;9&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;table &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;width&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="800px"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; height&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="500px"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; border&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="1"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;10&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;tr&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;11&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;td &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;height&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="50px"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; valign&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="middle"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; align&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="center"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; colspan&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="2"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;12&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                Ejemplo de DefaultButton. &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;13&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;br &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;14&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:Label &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="lblDefault"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:Label&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;15&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;td&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;16&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;tr&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;17&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;tr&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;18&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;td &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;width&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="30%"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; valign&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="top"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; align&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="center"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;19&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:TextBox &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="TextBox2"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:TextBox&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;&amp;amp;nbsp;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;20&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:Button &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="btnBuscar"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; Text&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Buscar"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; OnClick&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="btnBuscar_Click"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;td&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;21&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;td &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;width&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="*"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; valign&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="top"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;22&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:Panel &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Panel1"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; Width&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="250px"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; DefaultButton&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="btnEnviar"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;23&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:Label &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Label1"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; Text&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Nombre"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:Label&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;&amp;amp;nbsp;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;24&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:TextBox &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="TextBox1"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:TextBox&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;br &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;25&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:Label &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Label2"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; Text&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Apellidos"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:Label&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;&amp;amp;nbsp;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;26&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:TextBox &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="TextBox3"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:TextBox&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;br &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;27&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:Label &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Label3"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; Text&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Dirección"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:Label&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;&amp;amp;nbsp;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;28&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:TextBox &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="TextBox4"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:TextBox&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;br &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;29&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:Label &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Label5"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; Text&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Telefono"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:Label&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;&amp;amp;nbsp;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;30&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:TextBox &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="TextBox6"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:TextBox&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;br &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;br &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;br &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;31&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:Button &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="btnEnviar"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; Text&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Enviar"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; OnClick&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="btnEnviar_Click"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;br &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;32&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:Panel&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;33&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;td&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;34&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;tr&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;35&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;table&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;36&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;form&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;37&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;body&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;38&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;html&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;&lt;img src ="http://blogs.clearscreen.com/dtax/aggbug/1341.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>Otra de las pequeñas funcionalidades que nos ofrece ASP.NET 2.0 es la de asignar botones por defecto para un formulario cuando se pulsa la tecla ENTER.</p>
<p>Esta funcionalidad se podía conseguir añadiendo una función bastante sencillita de JavaScript en nuestras páginas de ASP.NET 1.0 ó 1.1, pero ahora simplemente es una propiedad más del tag FORM o incluso podemos definir un botón por defecto para un Panel.</p>
<p>Ahora cuando pulsamos la tecla ENTER en una página de ASP.NET 2.0 se dispara el evento del primer botón que haya en el formulario a menos que hayamos indicado mediante la propiedad DefaultButton de la etiqueta FORM que botón queremos que sea el botón por defecto.</p>
<p>Pero si en nuestro formulario tenemos más de un botón  y desde una zona determinada de nuestro formulario queremos que se dispare un evento de un botón diferente al del resto del formulario también tenemos la propiedad DefaultButton en el control Panel.</p>
<p>Y como en otros posts de esta serie, un ejemplo para que veáis como funciona esto:<br /><br />
</p><div><!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="COLOR: #008080">1</span> <span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">@ Page Language</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">C#</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> CodeFile</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">Default.aspx.cs</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> Inherits</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">Default_aspx</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">2</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">3</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">html </span><span style="COLOR: #ff0000">xmlns</span><span style="COLOR: #0000ff">="http://www.w3.org/1999/xhtml"</span><span style="COLOR: #ff0000"> </span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">4</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">head </span><span style="COLOR: #ff0000">runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">5</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Ejemplo de Default Button</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">6</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">7</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">8</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #008080">1</span> <span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">form </span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="form1"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> defaultbutton</span><span style="COLOR: #0000ff">="btnBuscar"</span><span style="COLOR: #0000ff">&gt;</span> <br /><span style="COLOR: #008080">9</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">table </span><span style="COLOR: #ff0000">width</span><span style="COLOR: #0000ff">="800px"</span><span style="COLOR: #ff0000"> height</span><span style="COLOR: #0000ff">="500px"</span><span style="COLOR: #ff0000"> border</span><span style="COLOR: #0000ff">="1"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">10</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td </span><span style="COLOR: #ff0000">height</span><span style="COLOR: #0000ff">="50px"</span><span style="COLOR: #ff0000"> valign</span><span style="COLOR: #0000ff">="middle"</span><span style="COLOR: #ff0000"> align</span><span style="COLOR: #0000ff">="center"</span><span style="COLOR: #ff0000"> colspan</span><span style="COLOR: #0000ff">="2"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">12</span> <span style="COLOR: #000000">                Ejemplo de DefaultButton. </span><br /><span style="COLOR: #008080">13</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br </span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">14</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:Label </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="lblDefault"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">asp:Label</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">15</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">16</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">17</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">18</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td </span><span style="COLOR: #ff0000">width</span><span style="COLOR: #0000ff">="30%"</span><span style="COLOR: #ff0000"> valign</span><span style="COLOR: #0000ff">="top"</span><span style="COLOR: #ff0000"> align</span><span style="COLOR: #0000ff">="center"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">19</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:TextBox </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="TextBox2"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">asp:TextBox</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><span style="COLOR: #ff0000">&amp;nbsp;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">20</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:Button </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="btnBuscar"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> Text</span><span style="COLOR: #0000ff">="Buscar"</span><span style="COLOR: #ff0000"> OnClick</span><span style="COLOR: #0000ff">="btnBuscar_Click"</span><span style="COLOR: #ff0000"> </span><span style="COLOR: #0000ff">/&gt;&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">21</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">td </span><span style="COLOR: #ff0000">width</span><span style="COLOR: #0000ff">="*"</span><span style="COLOR: #ff0000"> valign</span><span style="COLOR: #0000ff">="top"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">22</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:Panel </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="Panel1"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> Width</span><span style="COLOR: #0000ff">="250px"</span><span style="COLOR: #ff0000"> DefaultButton</span><span style="COLOR: #0000ff">="btnEnviar"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">23</span> <span style="COLOR: #000000">                    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:Label </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="Label1"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> Text</span><span style="COLOR: #0000ff">="Nombre"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">asp:Label</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #ff0000">&amp;nbsp;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">24</span> <span style="COLOR: #000000">                    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:TextBox </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="TextBox1"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">asp:TextBox</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">br </span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">25</span> <span style="COLOR: #000000">                    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:Label </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="Label2"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> Text</span><span style="COLOR: #0000ff">="Apellidos"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">asp:Label</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #ff0000">&amp;nbsp;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">26</span> <span style="COLOR: #000000">                    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:TextBox </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="TextBox3"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">asp:TextBox</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">br </span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">27</span> <span style="COLOR: #000000">                    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:Label </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="Label3"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> Text</span><span style="COLOR: #0000ff">="Dirección"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">asp:Label</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #ff0000">&amp;nbsp;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">28</span> <span style="COLOR: #000000">                    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:TextBox </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="TextBox4"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">asp:TextBox</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">br </span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">29</span> <span style="COLOR: #000000">                    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:Label </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="Label5"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> Text</span><span style="COLOR: #0000ff">="Telefono"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">asp:Label</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #ff0000">&amp;nbsp;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">30</span> <span style="COLOR: #000000">                    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:TextBox </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="TextBox6"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">asp:TextBox</span><span style="COLOR: #0000ff">&gt;&lt;</span><span style="COLOR: #800000">br </span><span style="COLOR: #0000ff">/&gt;&lt;</span><span style="COLOR: #800000">br </span><span style="COLOR: #0000ff">/&gt;&lt;</span><span style="COLOR: #800000">br </span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">31</span> <span style="COLOR: #000000">                    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:Button </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="btnEnviar"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> Text</span><span style="COLOR: #0000ff">="Enviar"</span><span style="COLOR: #ff0000"> OnClick</span><span style="COLOR: #0000ff">="btnEnviar_Click"</span><span style="COLOR: #ff0000"> </span><span style="COLOR: #0000ff">/&gt;&lt;</span><span style="COLOR: #800000">br </span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">32</span> <span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">asp:Panel</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">33</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">td</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">34</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">tr</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">35</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">table</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">36</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">form</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">37</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">38</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span></div>
<p></p><img src ="http://blogs.clearscreen.com/dtax/aggbug/1341.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Jesús Jiménez</dc:creator><title>ASP.NET 2.0 Series: Validation Groups</title><link>http://blogs.clearscreen.com/dtax/archive/2005/04/03/1258.aspx</link><pubDate>Sun, 03 Apr 2005 22:25:00 GMT</pubDate><guid>http://blogs.clearscreen.com/dtax/archive/2005/04/03/1258.aspx</guid><wfw:comment>http://blogs.clearscreen.com/dtax/comments/1258.aspx</wfw:comment><comments>http://blogs.clearscreen.com/dtax/archive/2005/04/03/1258.aspx#Feedback</comments><slash:comments>17</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/dtax/comments/commentRss/1258.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/dtax/services/trackbacks/1258.aspx</trackback:ping><description>&lt;p&gt;En versiones anteriores de ASP.NET, la 1.0 y 1.1, teníamos un gran problema cuando queríamos validar solo determinados controles dentro de una página. &lt;/p&gt;
&lt;p&gt;Pongamos el caso en el que nuestra aplicación ASP.NET tiene una cabecera donde hemos arrastrado un WebUserControl que encapsula la funcionalidad de login con dos cajas de texto y un botón para autenticarse en nuestra aplicación.&lt;br /&gt;&lt;br /&gt;Por otro lado tenemos en la parte de contenido de la página un formulario para pedir información sobre nuestros productos. Al final de este formulario tenemos un botón que verifica los datos del formulario y procesa el envío del formulario a nuestro sistema.&lt;/p&gt;
&lt;p&gt;En general, salvo que montases alguna estratagema para conseguir validar solo los controles del formulario, el botón de envío de validaría el formulario entero y si las cajas de texto del login y pass del WebUserControl no nos dejaría continuar.&lt;/p&gt;
&lt;p&gt;Este es un problema real que existe en la versión actual de ASP.NET y en ASP.NET 2.0 lo han tenido en cuenta y han  creado los Validation Groups.&lt;/p&gt;
&lt;p&gt;Como su propio nombre indica en ASP.NET 2.0 se pueden crear grupos de validación y especificar que grupo de validación valida cada botón de tu formulario.&lt;/p&gt;
&lt;p&gt;La mejor forma de verlo un ejemplo:&lt;/p&gt;&lt;br /&gt;
&lt;div&gt;&lt;span style="COLOR: #008080"&gt;1&lt;/span&gt; &lt;span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;@ Page Language&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;C#&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; CodeFile&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;Default.aspx.cs&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; Inherits&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;Default_aspx&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; &lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;2&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;3&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;!&lt;/span&gt;&lt;span style="COLOR: #ff00ff"&gt;DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;4&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;5&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;html &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="http://www.w3.org/1999/xhtml"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;6&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;head &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;7&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;title&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;Untitled Page&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;title&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;8&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;head&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;9&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;body&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;10&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;form &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;id&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="form1"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;11&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;div&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;12&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:TextBox &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="TextBox1"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:TextBox&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;13&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:Button &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Button1"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; Text&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Validar Grupo 1"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; ValidationGroup&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Grupo1"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;14&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:RequiredFieldValidator &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="RequiredFieldValidator1"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; ErrorMessage&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Grupo 1 de validación"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;15&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;                ControlToValidate&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="TextBox1"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; ValidationGroup&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Grupo1"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;*&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:RequiredFieldValidator&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;16&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;br &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;17&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:TextBox &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="TextBox2"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:TextBox&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;18&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:Button &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Button2"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; Text&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Validar Grupo 2"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; ValidationGroup&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Grupo2"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;19&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:RequiredFieldValidator &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="RequiredFieldValidator2"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; ErrorMessage&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Grupo 2 de validación"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;20&lt;/span&gt; &lt;span style="COLOR: #ff0000"&gt;                ControlToValidate&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="TextBox2"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; ValidationGroup&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Grupo2"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;*&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;asp:RequiredFieldValidator&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;21&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;div&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;22&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;form&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;23&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;body&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;24&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #800000"&gt;html&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;25&lt;/span&gt; &lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;font color="#ff0000"&gt;&lt;strong&gt;Post Update:&lt;/strong&gt;&lt;/font&gt; Añadí un link al codigo de ejemplo. &lt;br /&gt;&lt;br /&gt;De aquí puedes descargar el código de este ejemplo.&lt;br /&gt;&lt;a href="http://blogs.clearscreen.com/dtax/files/ValidationGroupsWeb.zip"&gt;http://blogs.clearscreen.com/dtax/files/ValidationGroupsWeb.zip&lt;/a&gt;&lt;img src ="http://blogs.clearscreen.com/dtax/aggbug/1258.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>En versiones anteriores de ASP.NET, la 1.0 y 1.1, teníamos un gran problema cuando queríamos validar solo determinados controles dentro de una página. </p>
<p>Pongamos el caso en el que nuestra aplicación ASP.NET tiene una cabecera donde hemos arrastrado un WebUserControl que encapsula la funcionalidad de login con dos cajas de texto y un botón para autenticarse en nuestra aplicación.<br /><br />Por otro lado tenemos en la parte de contenido de la página un formulario para pedir información sobre nuestros productos. Al final de este formulario tenemos un botón que verifica los datos del formulario y procesa el envío del formulario a nuestro sistema.</p>
<p>En general, salvo que montases alguna estratagema para conseguir validar solo los controles del formulario, el botón de envío de validaría el formulario entero y si las cajas de texto del login y pass del WebUserControl no nos dejaría continuar.</p>
<p>Este es un problema real que existe en la versión actual de ASP.NET y en ASP.NET 2.0 lo han tenido en cuenta y han  creado los Validation Groups.</p>
<p>Como su propio nombre indica en ASP.NET 2.0 se pueden crear grupos de validación y especificar que grupo de validación valida cada botón de tu formulario.</p>
<p>La mejor forma de verlo un ejemplo:</p><br />
<div><span style="COLOR: #008080">1</span> <span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">&lt;%</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">@ Page Language</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">C#</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> CodeFile</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">Default.aspx.cs</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> Inherits</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">Default_aspx</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">2</span> <span style="COLOR: #000000"></span><br /><span style="COLOR: #008080">3</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;!</span><span style="COLOR: #ff00ff">DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">4</span> <span style="COLOR: #000000"></span><br /><span style="COLOR: #008080">5</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">html </span><span style="COLOR: #ff0000">xmlns</span><span style="COLOR: #0000ff">="http://www.w3.org/1999/xhtml"</span><span style="COLOR: #ff0000"> </span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">6</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">head </span><span style="COLOR: #ff0000">runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">7</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Untitled Page</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">8</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">9</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">10</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">form </span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="form1"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">11</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">div</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">12</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:TextBox </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="TextBox1"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">asp:TextBox</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">13</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:Button </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="Button1"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> Text</span><span style="COLOR: #0000ff">="Validar Grupo 1"</span><span style="COLOR: #ff0000"> ValidationGroup</span><span style="COLOR: #0000ff">="Grupo1"</span><span style="COLOR: #ff0000"> </span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">14</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:RequiredFieldValidator </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="RequiredFieldValidator1"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> ErrorMessage</span><span style="COLOR: #0000ff">="Grupo 1 de validación"</span><span style="COLOR: #ff0000"> </span><br /><span style="COLOR: #008080">15</span> <span style="COLOR: #ff0000">                ControlToValidate</span><span style="COLOR: #0000ff">="TextBox1"</span><span style="COLOR: #ff0000"> ValidationGroup</span><span style="COLOR: #0000ff">="Grupo1"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">*</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">asp:RequiredFieldValidator</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">16</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">br </span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">17</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:TextBox </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="TextBox2"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;&lt;/</span><span style="COLOR: #800000">asp:TextBox</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">18</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:Button </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="Button2"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> Text</span><span style="COLOR: #0000ff">="Validar Grupo 2"</span><span style="COLOR: #ff0000"> ValidationGroup</span><span style="COLOR: #0000ff">="Grupo2"</span><span style="COLOR: #ff0000"> </span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">19</span> <span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">&lt;</span><span style="COLOR: #800000">asp:RequiredFieldValidator </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="RequiredFieldValidator2"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> ErrorMessage</span><span style="COLOR: #0000ff">="Grupo 2 de validación"</span><span style="COLOR: #ff0000"> </span><br /><span style="COLOR: #008080">20</span> <span style="COLOR: #ff0000">                ControlToValidate</span><span style="COLOR: #0000ff">="TextBox2"</span><span style="COLOR: #ff0000"> ValidationGroup</span><span style="COLOR: #0000ff">="Grupo2"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">*</span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">asp:RequiredFieldValidator</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">21</span> <span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">div</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">22</span> <span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">form</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">23</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">24</span> <span style="COLOR: #000000"></span><span style="COLOR: #0000ff">&lt;/</span><span style="COLOR: #800000">html</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">25</span> <span style="COLOR: #000000"></span></div><br /><font color="#ff0000"><strong>Post Update:</strong></font> Añadí un link al codigo de ejemplo. <br /><br />De aquí puedes descargar el código de este ejemplo.<br /><a href="http://blogs.clearscreen.com/dtax/files/ValidationGroupsWeb.zip">http://blogs.clearscreen.com/dtax/files/ValidationGroupsWeb.zip</a><img src ="http://blogs.clearscreen.com/dtax/aggbug/1258.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Jesús Jiménez</dc:creator><title>ASP.NET 2.0 Series</title><link>http://blogs.clearscreen.com/dtax/archive/2005/04/03/1257.aspx</link><pubDate>Sun, 03 Apr 2005 22:16:00 GMT</pubDate><guid>http://blogs.clearscreen.com/dtax/archive/2005/04/03/1257.aspx</guid><wfw:comment>http://blogs.clearscreen.com/dtax/comments/1257.aspx</wfw:comment><comments>http://blogs.clearscreen.com/dtax/archive/2005/04/03/1257.aspx#Feedback</comments><slash:comments>3</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/dtax/comments/commentRss/1257.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/dtax/services/trackbacks/1257.aspx</trackback:ping><description>&lt;p&gt;Debido a que me gustaría tocar muchos temas de ASP.NET 2.0 y por motivos de organización he creado una nueva categoria en mi blog.&lt;/p&gt;
&lt;p&gt;"ASP.NET 2.0 Series" englobara todos los post que ire haciendo de esta nueva tecnología. Y para no andarme con más rodeos ahi va el primer post de esta nueva categoría.&lt;/p&gt;&lt;img src ="http://blogs.clearscreen.com/dtax/aggbug/1257.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>Debido a que me gustaría tocar muchos temas de ASP.NET 2.0 y por motivos de organización he creado una nueva categoria en mi blog.</p>
<p>"ASP.NET 2.0 Series" englobara todos los post que ire haciendo de esta nueva tecnología. Y para no andarme con más rodeos ahi va el primer post de esta nueva categoría.</p><img src ="http://blogs.clearscreen.com/dtax/aggbug/1257.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Jesús Jiménez</dc:creator><title>ASP.NET Page LifeCycle</title><link>http://blogs.clearscreen.com/dtax/archive/2005/03/26/1225.aspx</link><pubDate>Sat, 26 Mar 2005 13:44:00 GMT</pubDate><guid>http://blogs.clearscreen.com/dtax/archive/2005/03/26/1225.aspx</guid><wfw:comment>http://blogs.clearscreen.com/dtax/comments/1225.aspx</wfw:comment><comments>http://blogs.clearscreen.com/dtax/archive/2005/03/26/1225.aspx#Feedback</comments><slash:comments>6</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/dtax/comments/commentRss/1225.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/dtax/services/trackbacks/1225.aspx</trackback:ping><description>&lt;p&gt;Aunque hace ya algun tiempo que &lt;a href="http://hydrate.typepad.com/leo/"&gt;Léon andrianarivony&lt;/a&gt; posteo este diagrama del &lt;a href="http://hydrate.typepad.com/leo/2004/08/the_aspnet_v20_.html"&gt;ciclo de vida de las paginas ASP.NET&lt;/a&gt; me ha parecido interesante hacer un post.&lt;br /&gt;&lt;br /&gt;Este diagrama se basa en las paginas de ASP.NET 2.0 (Beta 1) y aun que no se esperan grandes cambios es posible que este ciclo cambie.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;img src="/dtax/files/aspNET_Page_LifeCycle.jpg" /&gt;&lt;img src ="http://blogs.clearscreen.com/dtax/aggbug/1225.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>Aunque hace ya algun tiempo que <a href="http://hydrate.typepad.com/leo/">Léon andrianarivony</a> posteo este diagrama del <a href="http://hydrate.typepad.com/leo/2004/08/the_aspnet_v20_.html">ciclo de vida de las paginas ASP.NET</a> me ha parecido interesante hacer un post.<br /><br />Este diagrama se basa en las paginas de ASP.NET 2.0 (Beta 1) y aun que no se esperan grandes cambios es posible que este ciclo cambie.<br /><br /></p><img src="/dtax/files/aspNET_Page_LifeCycle.jpg" /><img src ="http://blogs.clearscreen.com/dtax/aggbug/1225.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Jesús Jiménez</dc:creator><title>Cross-Page Posting</title><link>http://blogs.clearscreen.com/dtax/archive/2005/03/25/1223.aspx</link><pubDate>Fri, 25 Mar 2005 21:38:00 GMT</pubDate><guid>http://blogs.clearscreen.com/dtax/archive/2005/03/25/1223.aspx</guid><wfw:comment>http://blogs.clearscreen.com/dtax/comments/1223.aspx</wfw:comment><comments>http://blogs.clearscreen.com/dtax/archive/2005/03/25/1223.aspx#Feedback</comments><slash:comments>13</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/dtax/comments/commentRss/1223.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/dtax/services/trackbacks/1223.aspx</trackback:ping><description>&lt;p&gt;Estos días he estado leyendo sobre algo que nos ofrece ASP.NET 2.0 y que me parece muy útil, el Cross-Page Posting.&lt;/p&gt;
&lt;p&gt;Para usar esta característica tenemos a nuestra disposición dos propiedades que nos proporcionaran todo lo necesario.&lt;/p&gt;
&lt;p&gt;• PostbackUrl: Esta nueva propiedad del control Button nos permite establecer cual será la pagina a la que se redirecionara al usuario cuando pulsemos el botón y después de que el código que hayamos escrito en el evento del botón se ejecute.&lt;br /&gt;Esta propiedad es pública y de tipo string. Se puede establecer tanto en entorno de diseño como en entorno de ejecución.&lt;/p&gt;
&lt;p&gt;• PreviousPage: Con esta propiedad desde nuestra página de destino podemos acceder a la página desde la que venimos y como podemos acceder a todos sus controles y ver que valores fueron enviados en el post.&lt;br /&gt;Esta propiedad es de solo lectura y de tipo Page.&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;La cuestión es que con este método podemos ahorrarnos, en algunos casos, esos tan poco estéticos QueryStrings.&lt;/p&gt;
&lt;p&gt;En esta pagina Default.aspx hemos establecido la propiedad PostBackUrl de btnNextPage igual a Default2.aspx.&lt;br /&gt;&lt;br /&gt;
&lt;/p&gt;&lt;div&gt;&lt;!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--&gt;&lt;span style="COLOR: #008080"&gt;1&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00"&gt;&lt;span id="Highlighter_2_73_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"&gt;...&lt;/span&gt;&lt;span id="Highlighter_2_73_Open_Text"&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;@ Page Language&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;C#&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; CodeFile&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;Default.aspx.cs&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; Inherits&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;=&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;Default_aspx&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt;"&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;2&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #ff00ff"&gt;DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;3&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #800000"&gt;html &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="http://www.w3.org/1999/xhtml"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;4&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #800000"&gt;head &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;5&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #800000"&gt;title&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;Cross-Page Posting Page 1&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;span style="COLOR: #800000"&amp;gt;title&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;6&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;span style="COLOR: #800000"&amp;gt;head&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;7&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #800000"&gt;body&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;8&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #800000"&gt;form &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;id&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="form1"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;9&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #800000"&gt;TABLE&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;10&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #800000"&gt;TR&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;11&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #800000"&gt;TD&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;12&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;                    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #800000"&gt;asp:Label &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="lblName"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; Text&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Introduzca su nombre :"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;span style="COLOR: #800000"&amp;gt;asp:Label&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;13&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;span style="COLOR: #800000"&amp;gt;TD&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;14&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;span style="COLOR: #800000"&amp;gt;TR&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;15&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #800000"&gt;TR&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;16&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #800000"&gt;TD&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;17&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;                    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #800000"&gt;asp:TextBox &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="tboxName"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;span style="COLOR: #800000"&amp;gt;asp:TextBox&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;18&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;                    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #800000"&gt;asp:RequiredFieldValidator &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="RequiredFieldValidator1"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;19&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;                        ErrorMessage&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Es un campo obligatorio"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; ControlToValidate&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="tboxName"&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;*&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;span style="COLOR: #800000"&amp;gt;asp:RequiredFieldValidator&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;20&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;span style="COLOR: #800000"&amp;gt;TD&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;21&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;span style="COLOR: #800000"&amp;gt;TR&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;22&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #800000"&gt;TR&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;23&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #800000"&gt;TD&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;24&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;                &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&lt;span style="COLOR: #800000"&gt;asp:Button &lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt;ID&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="btnNextPage"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; runat&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="server"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; Text&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="Página siguiente"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; PostBackUrl&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;="default2.aspx"&lt;/span&gt;&lt;span style="COLOR: #ff0000"&gt; &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;25&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;            &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;span style="COLOR: #800000"&amp;gt;TD&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;26&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;        &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;span style="COLOR: #800000"&amp;gt;TR&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;27&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;span style="COLOR: #800000"&amp;gt;TABLE&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;28&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;    &lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;span style="COLOR: #800000"&amp;gt;form&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;29&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;span style="COLOR: #800000"&amp;gt;body&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;span style="COLOR: #000000"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="COLOR: #008080"&gt;30&lt;/span&gt;&lt;span style="COLOR: #000000"&gt;&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;span style="COLOR: #800000"&amp;gt;html&lt;/span&gt;&lt;span style="COLOR: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Y en Default2.aspx realizamos las acciones necesarias para recuperar los datos de Default.aspx.
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;pre&gt;&lt;span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.Data;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.Configuration;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.Web;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.Web.Security;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.Web.UI;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.Web.UI.WebControls;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.Web.UI.WebControls.WebParts;
&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;using&lt;/span&gt; System.Web.UI.HtmlControls;

&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; partial &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;class&lt;/span&gt; Default2_aspx : System.Web.UI.Page

{
    &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;public&lt;/span&gt; Default2_aspx ()
    {
        Load += &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;new&lt;/span&gt; EventHandler(Page_Load);
    }
    
    &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;void&lt;/span&gt; Page_Load(&lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;object&lt;/span&gt; sender, EventArgs e)
    {
        &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//Comprobamos si nuestra pagina esta usando Cross-Page Posting.&lt;/span&gt;
        &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/span&gt; (Page.PreviousPage.IsCrossPagePostBack)
        {
            &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//Buscamos el control o controles que necesitemos.&lt;/span&gt;
            Control c &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; Page.PreviousPage.FindControl(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"tboxName"&lt;/span&gt;);

            &lt;span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;//Y asignamos o usamos los valores que se envaron atraves del PostBack.&lt;/span&gt;
            &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;if&lt;/span&gt; (c !&lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;null&lt;/span&gt;)
                lblPreviousData.Text &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; ((TextBox)c).Text;
            &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;else&lt;/span&gt;
                lblPreviousData.Text &lt;span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;=&lt;/span&gt; &lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"No se pudo tomar el valor"&lt;/span&gt;;
        }
        &lt;span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent"&gt;else&lt;/span&gt;
            Response.Redirect(&lt;span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4"&gt;"default.aspx"&lt;/span&gt;);
    }
}&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;&lt;br /&gt;Es una práctica bastante sencilla y útil.&lt;br /&gt;&lt;/p&gt;&lt;img src ="http://blogs.clearscreen.com/dtax/aggbug/1223.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>Estos días he estado leyendo sobre algo que nos ofrece ASP.NET 2.0 y que me parece muy útil, el Cross-Page Posting.</p>
<p>Para usar esta característica tenemos a nuestra disposición dos propiedades que nos proporcionaran todo lo necesario.</p>
<p>• PostbackUrl: Esta nueva propiedad del control Button nos permite establecer cual será la pagina a la que se redirecionara al usuario cuando pulsemos el botón y después de que el código que hayamos escrito en el evento del botón se ejecute.<br />Esta propiedad es pública y de tipo string. Se puede establecer tanto en entorno de diseño como en entorno de ejecución.</p>
<p>• PreviousPage: Con esta propiedad desde nuestra página de destino podemos acceder a la página desde la que venimos y como podemos acceder a todos sus controles y ver que valores fueron enviados en el post.<br />Esta propiedad es de solo lectura y de tipo Page.</p>
<p><br />La cuestión es que con este método podemos ahorrarnos, en algunos casos, esos tan poco estéticos QueryStrings.</p>
<p>En esta pagina Default.aspx hemos establecido la propiedad PostBackUrl de btnNextPage igual a Default2.aspx.<br /><br />
</p><div><!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="COLOR: #008080">1</span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00"><span id="Highlighter_2_73_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">...</span><span id="Highlighter_2_73_Open_Text"><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">@ Page Language</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">C#</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> CodeFile</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">Default.aspx.cs</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> Inherits</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">Default_aspx</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">"</span><span style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </span></span><span style="COLOR: #000000; BACKGROUND-COLOR: #ffff00">%&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">2</span><span style="COLOR: #000000"></span><span style="COLOR: #0000ff"><span style="COLOR: #ff00ff">DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">3</span><span style="COLOR: #000000"></span><span style="COLOR: #0000ff"><span style="COLOR: #800000">html </span><span style="COLOR: #ff0000">xmlns</span><span style="COLOR: #0000ff">="http://www.w3.org/1999/xhtml"</span><span style="COLOR: #ff0000"> </span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">4</span><span style="COLOR: #000000"></span><span style="COLOR: #0000ff"><span style="COLOR: #800000">head </span><span style="COLOR: #ff0000">runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">5</span><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff"><span style="COLOR: #800000">title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">Cross-Page Posting Page 1</span><span style="COLOR: #0000ff">span style="COLOR: #800000"&gt;title</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">6</span><span style="COLOR: #000000"></span><span style="COLOR: #0000ff">span style="COLOR: #800000"&gt;head</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">7</span><span style="COLOR: #000000"></span><span style="COLOR: #0000ff"><span style="COLOR: #800000">body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">8</span><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff"><span style="COLOR: #800000">form </span><span style="COLOR: #ff0000">id</span><span style="COLOR: #0000ff">="form1"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">9</span><span style="COLOR: #000000">        </span><span style="COLOR: #0000ff"><span style="COLOR: #800000">TABLE</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">10</span><span style="COLOR: #000000">            </span><span style="COLOR: #0000ff"><span style="COLOR: #800000">TR</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">11</span><span style="COLOR: #000000">                </span><span style="COLOR: #0000ff"><span style="COLOR: #800000">TD</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">12</span><span style="COLOR: #000000">                    </span><span style="COLOR: #0000ff"><span style="COLOR: #800000">asp:Label </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="lblName"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> Text</span><span style="COLOR: #0000ff">="Introduzca su nombre :"</span><span style="COLOR: #0000ff">&gt;span style="COLOR: #800000"&gt;asp:Label</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">13</span><span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">span style="COLOR: #800000"&gt;TD</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">14</span><span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">span style="COLOR: #800000"&gt;TR</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">15</span><span style="COLOR: #000000">            </span><span style="COLOR: #0000ff"><span style="COLOR: #800000">TR</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">16</span><span style="COLOR: #000000">                </span><span style="COLOR: #0000ff"><span style="COLOR: #800000">TD</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">17</span><span style="COLOR: #000000">                    </span><span style="COLOR: #0000ff"><span style="COLOR: #800000">asp:TextBox </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="tboxName"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #0000ff">&gt;span style="COLOR: #800000"&gt;asp:TextBox</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">18</span><span style="COLOR: #000000">                    </span><span style="COLOR: #0000ff"><span style="COLOR: #800000">asp:RequiredFieldValidator </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="RequiredFieldValidator1"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> </span><br /><span style="COLOR: #008080">19</span><span style="COLOR: #ff0000">                        ErrorMessage</span><span style="COLOR: #0000ff">="Es un campo obligatorio"</span><span style="COLOR: #ff0000"> ControlToValidate</span><span style="COLOR: #0000ff">="tboxName"</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000">*</span><span style="COLOR: #0000ff">span style="COLOR: #800000"&gt;asp:RequiredFieldValidator</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">20</span><span style="COLOR: #000000">                </span><span style="COLOR: #0000ff">span style="COLOR: #800000"&gt;TD</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">21</span><span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">span style="COLOR: #800000"&gt;TR</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">22</span><span style="COLOR: #000000">            </span><span style="COLOR: #0000ff"><span style="COLOR: #800000">TR</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">23</span><span style="COLOR: #000000">            </span><span style="COLOR: #0000ff"><span style="COLOR: #800000">TD</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">24</span><span style="COLOR: #000000">                </span><span style="COLOR: #0000ff"><span style="COLOR: #800000">asp:Button </span><span style="COLOR: #ff0000">ID</span><span style="COLOR: #0000ff">="btnNextPage"</span><span style="COLOR: #ff0000"> runat</span><span style="COLOR: #0000ff">="server"</span><span style="COLOR: #ff0000"> Text</span><span style="COLOR: #0000ff">="Página siguiente"</span><span style="COLOR: #ff0000"> PostBackUrl</span><span style="COLOR: #0000ff">="default2.aspx"</span><span style="COLOR: #ff0000"> </span><span style="COLOR: #0000ff">/&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">25</span><span style="COLOR: #000000">            </span><span style="COLOR: #0000ff">span style="COLOR: #800000"&gt;TD</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">26</span><span style="COLOR: #000000">        </span><span style="COLOR: #0000ff">span style="COLOR: #800000"&gt;TR</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">27</span><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">span style="COLOR: #800000"&gt;TABLE</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">28</span><span style="COLOR: #000000">    </span><span style="COLOR: #0000ff">span style="COLOR: #800000"&gt;form</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">29</span><span style="COLOR: #000000"></span><span style="COLOR: #0000ff">span style="COLOR: #800000"&gt;body</span><span style="COLOR: #0000ff">&gt;</span><span style="COLOR: #000000"> </span><br /><span style="COLOR: #008080">30</span><span style="COLOR: #000000"></span><span style="COLOR: #0000ff">span style="COLOR: #800000"&gt;html</span><span style="COLOR: #0000ff">&gt;</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div><br /><br />Y en Default2.aspx realizamos las acciones necesarias para recuperar los datos de Default.aspx.
<p></p>
<p></p><pre><span style="FONT-SIZE: 11px; COLOR: black; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">
<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System;
<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.Data;
<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.Configuration;
<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.Web;
<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.Web.Security;
<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.Web.UI;
<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.Web.UI.WebControls;
<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.Web.UI.WebControls.WebParts;
<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">using</span> System.Web.UI.HtmlControls;

<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span> partial <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">class</span> Default2_aspx : System.Web.UI.Page

{
    <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">public</span> Default2_aspx ()
    {
        Load += <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">new</span> EventHandler(Page_Load);
    }
    
    <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">void</span> Page_Load(<span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">object</span> sender, EventArgs e)
    {
        <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//Comprobamos si nuestra pagina esta usando Cross-Page Posting.</span>
        <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">if</span> (Page.PreviousPage.IsCrossPagePostBack)
        {
            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//Buscamos el control o controles que necesitemos.</span>
            Control c <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> Page.PreviousPage.FindControl(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"tboxName"</span>);

            <span style="FONT-SIZE: 11px; COLOR: green; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">//Y asignamos o usamos los valores que se envaron atraves del PostBack.</span>
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">if</span> (c !<span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">null</span>)
                lblPreviousData.Text <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> ((TextBox)c).Text;
            <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">else</span>
                lblPreviousData.Text <span style="FONT-SIZE: 11px; COLOR: red; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">=</span> <span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"No se pudo tomar el valor"</span>;
        }
        <span style="FONT-SIZE: 11px; COLOR: blue; FONT-FAMILY: Courier New; BACKGROUND-COLOR: transparent">else</span>
            Response.Redirect(<span style="FONT-SIZE: 11px; COLOR: #666666; FONT-FAMILY: Courier New; BACKGROUND-COLOR: #e4e4e4">"default.aspx"</span>);
    }
}</span></pre>
<p><br />Es una práctica bastante sencilla y útil.<br /></p><img src ="http://blogs.clearscreen.com/dtax/aggbug/1223.aspx" width = "1" height = "1" /></body></item><item><dc:creator>Jesús Jiménez</dc:creator><title>Explorando ASP.NET 2.0 usando Visual C# 2005</title><link>http://blogs.clearscreen.com/dtax/archive/2005/02/12/1027.aspx</link><pubDate>Sat, 12 Feb 2005 19:34:00 GMT</pubDate><guid>http://blogs.clearscreen.com/dtax/archive/2005/02/12/1027.aspx</guid><wfw:comment>http://blogs.clearscreen.com/dtax/comments/1027.aspx</wfw:comment><comments>http://blogs.clearscreen.com/dtax/archive/2005/02/12/1027.aspx#Feedback</comments><slash:comments>2</slash:comments><wfw:commentRss>http://blogs.clearscreen.com/dtax/comments/commentRss/1027.aspx</wfw:commentRss><trackback:ping>http://blogs.clearscreen.com/dtax/services/trackbacks/1027.aspx</trackback:ping><description>&lt;p&gt;El titulo de este post no es otro que el de un producto que &lt;a href="http://www.appdev.com/prodfamily.asp?catalog%5Fname=AppDevCatalog&amp;amp;category%5Fname=ASPC20Product"&gt;AppDev&lt;/a&gt; ha sacado al mercado consistente en un DVD ó 6 CDs con videos y documentación referente a ASP.NET 2.0. Su precio no es que sea muy agradable, 495$, pero por mediación de Microsoft se puede &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=2267b706-32d2-4c51-bed7-e6cabb6d8a75&amp;amp;DisplayLang=en"&gt;descargar desde la MSDN&lt;/a&gt; la ISO del primero de los CDs totalmente gratuita.&lt;/p&gt;
&lt;p&gt;Como podréis imaginar este producto esta en inglés por completo aunque casi me he visto todos los videos y son fáciles de enteder con un nivel medio de inglés. Ademas el que vayan haciendo todo lo que dicen de forma gráfica ayuda mucho a entender de que estan hablando.&lt;/p&gt;&lt;img src ="http://blogs.clearscreen.com/dtax/aggbug/1027.aspx" width = "1" height = "1" /&gt;</description><body xmlns="http://www.w3.org/1999/xhtml"><p>El titulo de este post no es otro que el de un producto que <a href="http://www.appdev.com/prodfamily.asp?catalog%5Fname=AppDevCatalog&amp;category%5Fname=ASPC20Product">AppDev</a> ha sacado al mercado consistente en un DVD ó 6 CDs con videos y documentación referente a ASP.NET 2.0. Su precio no es que sea muy agradable, 495$, pero por mediación de Microsoft se puede <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=2267b706-32d2-4c51-bed7-e6cabb6d8a75&amp;DisplayLang=en">descargar desde la MSDN</a> la ISO del primero de los CDs totalmente gratuita.</p>
<p>Como podréis imaginar este producto esta en inglés por completo aunque casi me he visto todos los videos y son fáciles de enteder con un nivel medio de inglés. Ademas el que vayan haciendo todo lo que dicen de forma gráfica ayuda mucho a entender de que estan hablando.</p><img src ="http://blogs.clearscreen.com/dtax/aggbug/1027.aspx" width = "1" height = "1" /></body></item></channel></rss>