<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://geeks.ms/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Amigo mío Siempre estas Programando en .NET : ASP.NET 3.5</title><link>http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+3.5/default.aspx</link><description>Etiquetas: ASP.NET 3.5</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><item><title>[ASP.NET] Security.Exception usando NHibernateProfiler en nuestra aplicación web</title><link>http://geeks.ms/blogs/lruiz/archive/2011/10/24/asp-net-security-exception-usando-nhibernateprofiler-en-nuestra-aplicaci-243-n-web.aspx</link><pubDate>Mon, 24 Oct 2011 12:12:46 GMT</pubDate><guid isPermaLink="false">2a2e7ade-7474-448b-9de5-1515d8bb7d1b:201342</guid><dc:creator>Luis Ruiz Pavón</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://geeks.ms/blogs/lruiz/rsscomments.aspx?PostID=201342</wfw:commentRss><comments>http://geeks.ms/blogs/lruiz/archive/2011/10/24/asp-net-security-exception-usando-nhibernateprofiler-en-nuestra-aplicaci-243-n-web.aspx#comments</comments><description>Si trabajáis con NHibernate os recomiendo que uséis NHibernate Profiler para que podáis ver todo lo que está pasando entre vuestra aplicación y la base de datos. Si intentas inicializar el profiler en una aplicación ASP.NET: void Application_Start( object sender, EventArgs e) { HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize(); } puede que te encuentres con esta excepción: Server Error in &amp;#39;/&amp;#39; Application. Security Exception Description: The application attempted...(&lt;a href="http://geeks.ms/blogs/lruiz/archive/2011/10/24/asp-net-security-exception-usando-nhibernateprofiler-en-nuestra-aplicaci-243-n-web.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://geeks.ms/aggbug.aspx?PostID=201342" width="1" height="1"&gt;</description><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+2.0/default.aspx">ASP.NET 2.0</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+3.5/default.aspx">ASP.NET 3.5</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+4.0/default.aspx">ASP.NET 4.0</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/NHibernate/default.aspx">NHibernate</category></item><item><title>He traducido el artículo “Upgrade an ASP.NET Web Application to ASP.NET 4”</title><link>http://geeks.ms/blogs/lruiz/archive/2010/10/21/he-traducido-el-art-237-culo-upgrade-an-asp-net-web-application-to-asp-net-4.aspx</link><pubDate>Thu, 21 Oct 2010 11:06:00 GMT</pubDate><guid isPermaLink="false">2a2e7ade-7474-448b-9de5-1515d8bb7d1b:183620</guid><dc:creator>Luis Ruiz Pavón</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://geeks.ms/blogs/lruiz/rsscomments.aspx?PostID=183620</wfw:commentRss><comments>http://geeks.ms/blogs/lruiz/archive/2010/10/21/he-traducido-el-art-237-culo-upgrade-an-asp-net-web-application-to-asp-net-4.aspx#comments</comments><description>El otro día en los foros de ASP.NET de la MSDN, Jesus preguntaba cuales eran los pasos a llevar cabo para migrar una aplicación ASP.NET 3.5 a 4.0: http://social.msdn.microsoft.com/Forums/es-ES/netfxwebes/thread/4a67c646-7e29-4354-b74d-4d6af15a4f0f/#b1f8467d-d819-492e-9250-6dbe6fffc314 En el foro puse un enlace a un artículo de Microsoft en el que se explican los pasos: How to: Upgrade an ASP.NET Web Application to ASP.NET 4 La cosa es que el artículo está en inglés, así que en mis ratos libres lo...(&lt;a href="http://geeks.ms/blogs/lruiz/archive/2010/10/21/he-traducido-el-art-237-culo-upgrade-an-asp-net-web-application-to-asp-net-4.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://geeks.ms/aggbug.aspx?PostID=183620" width="1" height="1"&gt;</description><enclosure url="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Components.PostAttachments/00.00.18.36.20/Asp.NET-4.0.pdf" length="430436" type="application/pdf" /><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+2.0/default.aspx">ASP.NET 2.0</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+3.5/default.aspx">ASP.NET 3.5</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+4.0/default.aspx">ASP.NET 4.0</category></item><item><title>[ASP.NET] Separar los Settings de nuestras librerías de clases en nuestro web.config en archivos individuales y encriptarlos</title><link>http://geeks.ms/blogs/lruiz/archive/2010/06/10/asp-net-separar-los-settings-de-nuestras-librer-237-as-de-clases-en-nuestro-web-config-en-archivos-individuales-y-encriptarlos.aspx</link><pubDate>Thu, 10 Jun 2010 14:35:00 GMT</pubDate><guid isPermaLink="false">2a2e7ade-7474-448b-9de5-1515d8bb7d1b:177904</guid><dc:creator>Luis Ruiz Pavón</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://geeks.ms/blogs/lruiz/rsscomments.aspx?PostID=177904</wfw:commentRss><comments>http://geeks.ms/blogs/lruiz/archive/2010/06/10/asp-net-separar-los-settings-de-nuestras-librer-237-as-de-clases-en-nuestro-web-config-en-archivos-individuales-y-encriptarlos.aspx#comments</comments><description>Vamos a empezar viendo un ejemplo de lo que se pretende para que nos quede m&amp;aacute;s claro. Tenemos la siguiente soluci&amp;oacute;n ficticia compuesta por 3 proyectos (La aplicaci&amp;oacute;n web y 2 librer&amp;iacute;as de clases para acceder a diferentes servicios web): Como pod&amp;eacute;is observar, cada librer&amp;iacute;a de clases tienes su propio fichero de Settings , donde almacenamos por ejemplo la url del servicio y las credenciales en el caso que se necesiten. Por ejemplo vamos a ver como quedar&amp;iacute;a...(&lt;a href="http://geeks.ms/blogs/lruiz/archive/2010/06/10/asp-net-separar-los-settings-de-nuestras-librer-237-as-de-clases-en-nuestro-web-config-en-archivos-individuales-y-encriptarlos.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://geeks.ms/aggbug.aspx?PostID=177904" width="1" height="1"&gt;</description><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+2.0/default.aspx">ASP.NET 2.0</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+3.5/default.aspx">ASP.NET 3.5</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/Deploy/default.aspx">Deploy</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/config/default.aspx">config</category></item><item><title>[ASP.NET] jQuery Templates</title><link>http://geeks.ms/blogs/lruiz/archive/2010/05/11/asp-net-jquery-templates.aspx</link><pubDate>Tue, 11 May 2010 11:48:00 GMT</pubDate><guid isPermaLink="false">2a2e7ade-7474-448b-9de5-1515d8bb7d1b:176746</guid><dc:creator>Luis Ruiz Pavón</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://geeks.ms/blogs/lruiz/rsscomments.aspx?PostID=176746</wfw:commentRss><comments>http://geeks.ms/blogs/lruiz/archive/2010/05/11/asp-net-jquery-templates.aspx#comments</comments><description>&lt;p&gt;&lt;img height="63" width="220" src="http://static.jquery.com/files/rocker/images/logo_jquery_215x53.gif" alt="jQuery: Write Less, Do More." /&gt;En el blog de Scoot hay un extenso &lt;a target="_blank" href="http://weblogs.asp.net/scottgu/archive/2010/05/07/jquery-templates-and-data-linking-and-microsoft-contributing-to-jquery.aspx"&gt;art&amp;iacute;culo&lt;/a&gt; sobre esta nueva contribuci&amp;oacute;n de &lt;strong&gt;Microsoft&lt;/strong&gt; a esta fant&amp;aacute;stica librer&amp;iacute;a como es &lt;a target="_blank" href="http://jquery.com/"&gt;jQuery&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Me voy a centrar en este art&amp;iacute;culo en las templates de cliente:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;iquest;Que s&amp;oacute;n?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Pues digamos que es como una mezcla de c&amp;oacute;digo javascript y HTML que nos permiten generar c&amp;oacute;digo HTML a trav&amp;eacute;s de un objeto o array de objetos javascript, algo como esto:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div id="codeSnippet" style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;
&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&amp;lt;script id=&lt;span style="color:#006080;"&gt;&amp;quot;productTemplate&amp;quot;&lt;/span&gt; type=&lt;span style="color:#006080;"&gt;&amp;quot;text/html&amp;quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &amp;lt;div&amp;gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        Product Id: {{= id }} &amp;lt;br /&amp;gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        Title: {{= title }} &amp;lt;br /&amp;gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        Description: {{= description }} &amp;lt;br /&amp;gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        Price: &amp;euro; {{= price }}&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &amp;lt;/div&amp;gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;

&lt;/p&gt;
&lt;p&gt;En este caso el objeto que vamos a represnetar (Product) tiene 4 propiedades (id, title, description, price) que est&amp;aacute;n representadas dentro de los corchetes. &lt;/p&gt;
&lt;p&gt;En el ejemplo que os voy a mostrar, los datos se est&amp;aacute;n consumiendo de un servicio REST desarrollado con WCF. &lt;/p&gt;
&lt;p&gt;Lo primero es la p&amp;aacute;gina aspx:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div id="codeSnippet" style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;
&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;asp:Content&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;ID&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Content1&amp;quot;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;ContentPlaceHolderID&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;head&amp;quot;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;runat&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&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;JQuery&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;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;asp:Content&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;asp:Content&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;ID&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Content2&amp;quot;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;ContentPlaceHolderID&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;MainContent&amp;quot;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;runat&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&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;How to use jQuery Templates&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;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;h1&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;List of Products&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;h1&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&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:#ff0000;"&gt;id&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;productsContainer&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&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;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;script&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;id&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;productTemplate&amp;quot;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;type&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;text/html&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span id="lnum1" style="color:#606060;"&gt;   1:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span id="lnum2" style="color:#606060;"&gt;   2:&lt;/span&gt;     &amp;lt;div&amp;gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span id="lnum3" style="color:#606060;"&gt;   3:&lt;/span&gt;         Product Id: {{= id }} &amp;lt;br /&amp;gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span id="lnum4" style="color:#606060;"&gt;   4:&lt;/span&gt;         Title: {{= title }} &amp;lt;br /&amp;gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span id="lnum5" style="color:#606060;"&gt;   5:&lt;/span&gt;         Description: {{= description }} &amp;lt;br /&amp;gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span id="lnum6" style="color:#606060;"&gt;   6:&lt;/span&gt;         Price: &amp;euro; {{= price }}&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span id="lnum7" style="color:#606060;"&gt;   7:&lt;/span&gt;     &amp;lt;/div&amp;gt;&lt;/pre&gt;
&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;script&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&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;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&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;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;input&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;id&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;btnGetProducts&amp;quot;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;type&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;button&amp;quot;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;value&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Get Products from WCF Service!!!&amp;quot;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;asp:Content&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Una vez que tenemos la p&amp;aacute;gina, a&amp;ntilde;adimos en la master la referencia a los scripts:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div id="codeSnippet" style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;
&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;script&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;src&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;../../Scripts/jquery-1.4.2.js&amp;quot;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;type&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;script&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;src&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;../../Scripts/Common.js&amp;quot;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;type&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;script&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;src&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;../../Scripts/jquery.tmpl.js&amp;quot;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;type&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;

&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;La librer&amp;iacute;a &lt;strong&gt;jquery.tmpl.js&lt;/strong&gt; la pod&amp;eacute;is descargar de aqu&amp;iacute;: &lt;a href="http://github.com/jquery/jquery-tmpl" title="http://github.com/jquery/jquery-tmpl"&gt;http://github.com/jquery/jquery-tmpl&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Ahora vamos con el c&amp;oacute;digo del fichero &lt;strong&gt;Common.js&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div id="codeSnippet" style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;
&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; serviceUrl = &lt;span style="color:#006080;"&gt;&amp;#39;http://localhost:49766/ProductService.svc&amp;#39;&lt;/span&gt;;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; getAllMethod = &lt;span style="color:#006080;"&gt;&amp;#39;/products/json&amp;#39;&lt;/span&gt;;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; postMethod   = &lt;span style="color:#006080;"&gt;&amp;#39;/products/json&amp;#39;&lt;/span&gt;;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; deleteMethod = &lt;span style="color:#006080;"&gt;&amp;#39;/products/{id}/json&amp;#39;&lt;/span&gt;;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;$(document).ready(&lt;span style="color:#0000ff;"&gt;function&lt;/span&gt;() {&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    $(&lt;span style="color:#006080;"&gt;&amp;#39;#btnGetProducts&amp;#39;&lt;/span&gt;).click(getProducts);&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;});&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;function&lt;/span&gt; getProducts() {&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#0000ff;"&gt;var&lt;/span&gt; noCache = Date();&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    $.getJSON(serviceUrl + getAllMethod, { &lt;span style="color:#006080;"&gt;&amp;#39;noCache&amp;#39;&lt;/span&gt;: noCache }, &lt;span style="color:#0000ff;"&gt;function&lt;/span&gt; process(details) {&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        details.length = details.length ? details.length : 0;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        $(&lt;span style="color:#006080;"&gt;&amp;#39;#opProducts&amp;#39;&lt;/span&gt;).children().remove();&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (details.length == 0) {&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;            alert(&lt;span style="color:#006080;"&gt;&amp;#39;No Products!!!&amp;#39;&lt;/span&gt;);&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        }&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        &lt;span style="color:#0000ff;"&gt;else&lt;/span&gt; {&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;            alert(details);&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;            $(&lt;span style="color:#006080;"&gt;&amp;quot;#productTemplate&amp;quot;&lt;/span&gt;).render(details).appendTo(&lt;span style="color:#006080;"&gt;&amp;quot;#productsContainer&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        }&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    });&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Lo interesante en este c&amp;oacute;digo es esta l&amp;iacute;nea:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div id="codeSnippet" style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;
&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;$(&lt;span style="color:#006080;"&gt;&amp;quot;#productTemplate&amp;quot;&lt;/span&gt;).render(details).appendTo(&lt;span style="color:#006080;"&gt;&amp;quot;#productsContainer&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;

&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;donde haciendo uso del m&amp;eacute;todo &lt;strong&gt;render&lt;/strong&gt; al que le pasamos el array de objetos que nos devuelve el servicio REST, para que lo renderize con la template y lo a&amp;ntilde;ada al div &lt;strong&gt;productsContainer &lt;/strong&gt;dando como resultado lo siguiente:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/image_5F00_2FD6A322.png"&gt;&lt;img height="284" width="522" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/image_5F00_thumb_5F00_7919481D.png" alt="image" border="0" title="image" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/image_5F00_73CA616C.png"&gt;&lt;img height="238" width="661" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/image_5F00_thumb_5F00_629683C9.png" alt="image" border="0" title="image" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/image_5F00_6F2430E5.png"&gt;&lt;img height="476" width="534" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/image_5F00_thumb_5F00_1FD73891.png" alt="image" border="0" title="image" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Y todo esto desde la parte cliente &amp;iquest;No os parece acojonante?&lt;/p&gt;
&lt;p&gt;Un saludo y atentos al siguiente ;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://geeks.ms/aggbug.aspx?PostID=176746" width="1" height="1"&gt;</description><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+2.0/default.aspx">ASP.NET 2.0</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/JSON/default.aspx">JSON</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+3.5/default.aspx">ASP.NET 3.5</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+MVC/default.aspx">ASP.NET MVC</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/JQuery/default.aspx">JQuery</category></item><item><title>[Tips] JQuery validate y como deshabilitar la validación en algunos botones</title><link>http://geeks.ms/blogs/lruiz/archive/2010/02/16/tips-jquery-validate-y-como-deshabilitar-la-validaci-243-n-en-algunos-botones.aspx</link><pubDate>Tue, 16 Feb 2010 12:46:26 GMT</pubDate><guid isPermaLink="false">2a2e7ade-7474-448b-9de5-1515d8bb7d1b:167498</guid><dc:creator>Luis Ruiz Pavón</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://geeks.ms/blogs/lruiz/rsscomments.aspx?PostID=167498</wfw:commentRss><comments>http://geeks.ms/blogs/lruiz/archive/2010/02/16/tips-jquery-validate-y-como-deshabilitar-la-validaci-243-n-en-algunos-botones.aspx#comments</comments><description>&lt;p&gt;Un Tip cortito, sí en una página ASP.NET tenemos varios botones que hacen submit (Por ejmplo por que tenemos varios controles de usuario) y queremos que un botón no lance la validación del formulario, basta con ponerle el atributo &lt;strong&gt;class&lt;/strong&gt; a &lt;strong&gt;cancel&lt;/strong&gt;:&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;btnDeleteComment.Attributes.Add(&lt;span style="color:#006080;"&gt;&amp;quot;class&amp;quot;&lt;/span&gt; ,&lt;span style="color:#006080;"&gt;&amp;quot;cancel&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Un saludo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://geeks.ms/aggbug.aspx?PostID=167498" width="1" height="1"&gt;</description><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+2.0/default.aspx">ASP.NET 2.0</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+3.5/default.aspx">ASP.NET 3.5</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/JQuery/default.aspx">JQuery</category></item><item><title>[ASP.NET] Simular un EmptyDataTemplate en un DataList</title><link>http://geeks.ms/blogs/lruiz/archive/2010/02/11/asp-net-simular-un-emptydatatemplate-en-un-datalist.aspx</link><pubDate>Thu, 11 Feb 2010 08:00:24 GMT</pubDate><guid isPermaLink="false">2a2e7ade-7474-448b-9de5-1515d8bb7d1b:167154</guid><dc:creator>Luis Ruiz Pavón</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://geeks.ms/blogs/lruiz/rsscomments.aspx?PostID=167154</wfw:commentRss><comments>http://geeks.ms/blogs/lruiz/archive/2010/02/11/asp-net-simular-un-emptydatatemplate-en-un-datalist.aspx#comments</comments><description>&lt;p&gt;Como sabréis, este tipo de template no está disponible en el control DataList (El GridView sí dispone de esta plantilla &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.emptydatatemplate.aspx" target="_blank"&gt;EmptyDataTemplate&lt;/a&gt;) para mostrar un mensaje informandole al usuario que no hay registros. Así que vamos a ver como con unas lineas de código podemos simularla:&lt;/p&gt;  &lt;p&gt;Yo en mi caso voy a utilizar el FooterTemplate del DataList como sí se tratase de mi EmptyDataTemplate:&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;FooterTemplate&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&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;=&amp;quot;lblNoRecords&amp;quot;&lt;/span&gt; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;               &lt;span style="color:#ff0000;"&gt;runat&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;               &lt;span style="color:#ff0000;"&gt;Visible&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt; &lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;               &lt;span style="color:#ff0000;"&gt;Text&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;No hay comentarios. Sea usted el primero.&amp;quot;&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;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;FooterTemplate&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Dentro del FooterTemplate, añado un Label que será el que muestre el mensaje en caso de no haber registros (En este caso concreto, sino hay comentarios).&lt;/p&gt;

&lt;p&gt;Una vez hecho esto, vamos al evento &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.datalist.itemdatabound.aspx" target="_blank"&gt;ItemDataBound&lt;/a&gt; del control y controlamos que el ItemType es del tipo Footer. Sí es, comprobamos que el número de registros es 0 y accedemos al label para ponerlo visible:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;/// Handles the ItemDataBound event of the dlComments control.&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;param name=&amp;quot;sender&amp;quot;&amp;gt;The source of the event.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;param name=&amp;quot;e&amp;quot;&amp;gt;The &amp;lt;see cref=&amp;quot;System.Web.UI.WebControls.DataListItemEventArgs&amp;quot;/&amp;gt; &lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#008000;"&gt;/// instance containing the event data.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; dlComments_ItemDataBound(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, DataListItemEventArgs e)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;{&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;    &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (e.Item.ItemType == ListItemType.Footer)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;    {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;        &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (dlComments.Items.Count == 0)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;        {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;            Label lblNoRecords = e.Item.FindControl(ControlNames.LABEL_NORECORDS) &lt;span style="color:#0000ff;"&gt;as&lt;/span&gt; Label;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;&amp;#160;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;            &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (lblNoRecords != &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;)&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;            {&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;                lblNoRecords.Visible = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;            }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;        }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:#f4f4f4;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;    }&lt;/pre&gt;


    &lt;pre style="border-bottom-style:none;text-align:left;padding-bottom:0px;line-height:12pt;border-right-style:none;background-color:white;margin:0em;padding-left:0px;width:100%;padding-right:0px;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;border-top-style:none;color:black;font-size:8pt;border-left-style:none;overflow:visible;padding-top:0px;"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Con esto hemos conseguido simular dicha template.&lt;/p&gt;

&lt;p&gt;Un saludo&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://geeks.ms/aggbug.aspx?PostID=167154" width="1" height="1"&gt;</description><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/Web/default.aspx">Web</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+2.0/default.aspx">ASP.NET 2.0</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+3.5/default.aspx">ASP.NET 3.5</category></item><item><title>[ASP.NET + VS 2008] Web Deployment Projects nos facilita los despliegues de nuestras aplicaciones web</title><link>http://geeks.ms/blogs/lruiz/archive/2009/10/13/asp-net-vs-2008-web-deployment-projects-nos-facilita-los-despliegues-de-nuestras-aplicaciones-web.aspx</link><pubDate>Tue, 13 Oct 2009 14:11:00 GMT</pubDate><guid isPermaLink="false">2a2e7ade-7474-448b-9de5-1515d8bb7d1b:157990</guid><dc:creator>Luis Ruiz Pavón</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://geeks.ms/blogs/lruiz/rsscomments.aspx?PostID=157990</wfw:commentRss><comments>http://geeks.ms/blogs/lruiz/archive/2009/10/13/asp-net-vs-2008-web-deployment-projects-nos-facilita-los-despliegues-de-nuestras-aplicaciones-web.aspx#comments</comments><description>&lt;p&gt;Como dije en mi anterior post, estas 3 &amp;uacute;ltimas semanas, he estado desplegando una soluci&amp;oacute;n bastante completa en un cliente y pensaba que no me iba a dar para escribir ning&amp;uacute;n post, pero olvid&amp;eacute; hacer menci&amp;oacute;n de la herramienta:&lt;/p&gt;
&lt;h3&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=0AA30AE8-C73B-4BDD-BB1B-FE697256C459&amp;amp;displaylang=en" target="_blank"&gt;Visual Studio&amp;reg; 2008 Web Deployment Projects &amp;ndash; RTW&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Seguro que tienes aplicaciones Web con varios config y settings para entornos diferentes DEV, PRE, PRO y muchas veces tienes que estar cambiando a mano dichos configs, settings&amp;hellip; con el consiguiente riesgo de pasar settings de DEV a PRE, PRE a PRO, etc&amp;hellip; bueno, pues esta herramienta nos va a facilitar bastante la labor de los despligues, ya que dada una configuraci&amp;oacute;n que nosotros mismos podemos crearnos, nos va a generar una soluci&amp;oacute;n lista para desplegar con sus settings correspondientes.&lt;/p&gt;
&lt;p&gt;Vamos a ver como funciona:&lt;/p&gt;
&lt;p&gt;Una vez descargada e instalada, vamos a generar un proyecto de prueba, en mi caso en Servicio Web sencillo y nos vamos al fichero Web.config y a&amp;ntilde;adimos una cadena de conexi&amp;oacute;n:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;" id="codeSnippet"&gt;
&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;connectionStrings&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&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;name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;eShopConnectionString&amp;quot;&lt;/span&gt; &lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;         &lt;span style="color:#ff0000;"&gt;connectionString&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Data Source=dev-sql; Initial Catalog=dev-db; Integrated Security=True&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;  &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;connectionStrings&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;En este caso, estar&amp;iacute;a apuntando al servidor Sql de Desarrollo. A continuaci&amp;oacute;n vamos a a&amp;ntilde;adir a nuestra soluci&amp;oacute;n un Web Deployment project:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp_5F00_77C023A3.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="wdp" border="0" alt="wdp" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp_5F00_thumb_5F00_6A799A90.png" width="327" height="222" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;A continuaci&amp;oacute;n vamos a crear 3 tipos de configuraci&amp;oacute;n a nuestro proyecto WDP:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Desarrollo (Debug)&lt;/li&gt;
&lt;li&gt;Pre-Producci&amp;oacute;n (Release)&lt;/li&gt;
&lt;li&gt;Producci&amp;oacute;n (Release)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp2_5F00_1A543C52.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="wdp2" border="0" alt="wdp2" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp2_5F00_thumb_5F00_065AA9BC.png" width="293" height="266" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp3_5F00_487E123F.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="wdp3" border="0" alt="wdp3" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp3_5F00_thumb_5F00_304A8217.png" width="644" height="365" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Desarrollo&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp4_5F00_375998C2.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="wdp4" border="0" alt="wdp4" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp4_5F00_thumb_5F00_6014FE0B.png" width="438" height="234" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pre-Producci&amp;oacute;n&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp5_5F00_04C61583.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="wdp5" border="0" alt="wdp5" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp5_5F00_thumb_5F00_107B5CB5.png" width="440" height="235" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Producci&amp;oacute;n&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp6_5F00_470907F9.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="wdp6" border="0" alt="wdp6" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp6_5F00_thumb_5F00_649AE2F8.png" width="440" height="235" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Una vez creadas las 3 configuraciones, vamos a crear 3 ficheros config con las cadenas de conexi&amp;oacute;n (En este caso solo contendr&amp;aacute;n una, pero podr&amp;iacute;an ser m&amp;aacute;s) de cada entorno:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp7_5F00_6211B13A.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="wdp7" border="0" alt="wdp7" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp7_5F00_thumb_5F00_327392AE.png" width="259" height="294" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Desarrollo&lt;/strong&gt;&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;" id="codeSnippet"&gt;
&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;connectionStrings&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&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;name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;eShopConnectionString&amp;quot;&lt;/span&gt; &lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;       &lt;span style="color:#ff0000;"&gt;connectionString&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Data Source=dev-sql; Initial Catalog=dev-db; Integrated Security=True&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;connectionStrings&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Pre-Producci&amp;oacute;n&lt;/strong&gt;&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;" id="codeSnippet"&gt;
&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;connectionStrings&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&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;name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;eShopConnectionString&amp;quot;&lt;/span&gt; &lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;       &lt;span style="color:#ff0000;"&gt;connectionString&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Data Source=pre-sql; Initial Catalog=pre-db; Integrated Security=True&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;connectionStrings&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Producci&amp;oacute;n&lt;/strong&gt;&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div style="text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;" id="codeSnippet"&gt;
&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;connectionStrings&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&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;name&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;eShopConnectionString&amp;quot;&lt;/span&gt; &lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;       &lt;span style="color:#ff0000;"&gt;connectionString&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Data Source=pro-sql; Initial Catalog=pro-db; Integrated Security=True&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="text-align:left;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;, courier, monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;connectionStrings&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Ahora, solo nos queda especificar para cada configuraci&amp;oacute;n de las que hicimos enteriormente, de que fichero de cadenas de conexi&amp;oacute;n obtendr&amp;aacute; la configuraci&amp;oacute;n:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Seleccionamos la configuraci&amp;oacute;n (&lt;strong&gt;Desarrollo&lt;/strong&gt;)&lt;/li&gt;
&lt;li&gt;En la opci&amp;oacute;n &lt;strong&gt;Deployment&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Activamos el check &lt;strong&gt;Enable Web.config file section replacement&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;A la secci&amp;oacute;n &lt;strong&gt;connectionStrings&lt;/strong&gt; de nuestro Web.config lo reemplazamos con lo que contiene el fichero de configuraciones del entorno de desarrollo.&lt;/li&gt;
&lt;li&gt;Marcamos el check &lt;strong&gt;Enforce matching section replacements&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp8_5F00_5790DD1A.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="wdp8" border="0" alt="wdp8" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp8_5F00_thumb_5F00_4A86D73C.png" width="644" height="384" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Y a las otras 2:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp7_5F00_58B52A5F.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="wdp7" border="0" alt="wdp7" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp7_5F00_thumb_5F00_7A04AA2E.png" width="644" height="384" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp10_5F00_3781E22B.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="wdp10" border="0" alt="wdp10" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp10_5F00_thumb_5F00_51B22582.png" width="644" height="384" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Una vez hecho todo el trabajo solo nos queda probar, compilamos la solcui&amp;oacute;n para cada configuraci&amp;oacute;n y nos vamos al directorio de nuestro proyecto y:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp11_5F00_2735CE98.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="wdp11" border="0" alt="wdp11" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp11_5F00_thumb_5F00_30425A19.png" width="598" height="176" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;cada carpeta:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp12_5F00_4316DDC3.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="wdp12" border="0" alt="wdp12" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/wdp12_5F00_thumb_5F00_25555304.png" width="599" height="182" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;lista para desplegar con su configuraci&amp;oacute;n correspondiente.&lt;/p&gt;
&lt;p&gt;Podemos hacer lo mismo con otras secciones de nuestro Web.config, como por ejemplo las appSettings ;)&lt;/p&gt;
&lt;p&gt;La verdad es que esta herramienta me ha gustado bastante, facilita mucho el trabajo a la hora de desplegar, nosotros usabamos otras t&amp;eacute;cnicas pero hemos adoptado a esta nueva herramienta.&lt;/p&gt;
&lt;p&gt;Salu2 y a disfrutar!!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://geeks.ms/aggbug.aspx?PostID=157990" width="1" height="1"&gt;</description><enclosure url="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Components.PostAttachments/00.00.15.79.90/WebSite1.zip" length="26667" type="application/x-zip-compressed" /><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/Web/default.aspx">Web</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+2.0/default.aspx">ASP.NET 2.0</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+3.5/default.aspx">ASP.NET 3.5</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/Add-in/default.aspx">Add-in</category></item><item><title>[ASP.NET] Redireccionar al usuario a la página de login cuando su sesión expira</title><link>http://geeks.ms/blogs/lruiz/archive/2009/05/28/asp-net-redireccionar-al-usuario-a-la-p-225-gina-de-login-cuando-su-sesi-243-n-expira.aspx</link><pubDate>Thu, 28 May 2009 13:07:00 GMT</pubDate><guid isPermaLink="false">2a2e7ade-7474-448b-9de5-1515d8bb7d1b:149483</guid><dc:creator>Luis Ruiz Pavón</dc:creator><slash:comments>10</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://geeks.ms/blogs/lruiz/rsscomments.aspx?PostID=149483</wfw:commentRss><comments>http://geeks.ms/blogs/lruiz/archive/2009/05/28/asp-net-redireccionar-al-usuario-a-la-p-225-gina-de-login-cuando-su-sesi-243-n-expira.aspx#comments</comments><description>&lt;p&gt;Es una pregunta frecuente en los foros de la &lt;a target="_blank" href="http://social.msdn.microsoft.com/Forums/es-ES/category/generaldeves"&gt;MSDN&lt;/a&gt; y que mejor manera de resolverla que con un ejemplo pr&amp;aacute;ctico.&lt;/p&gt;
&lt;p&gt;Lo primero que he hecho ha sido crearme una nueva clase a la que a&amp;ntilde;adir&amp;eacute; un &lt;a target="_blank" href="http://msdn.microsoft.com/en-us/library/bb383977.aspx"&gt;Extension Methods&lt;/a&gt; para la clase &lt;strong&gt;Page&lt;/strong&gt; y as&amp;iacute; poder utilizarlo como s&amp;iacute; de un m&amp;eacute;todo m&amp;aacute;s de la clase se tratara:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Helper.cs&lt;/strong&gt;&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;div style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Web;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Web.UI;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// Helper Class&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; Helper&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;{&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#008000;"&gt;/// Registers the redirect on session end script.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#008000;"&gt;/// &amp;lt;param name=&amp;quot;page&amp;quot;&amp;gt;The page.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; RegisterRedirectOnSessionEndScript(&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt; Page page)&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    {&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        &lt;span style="color:#008000;"&gt;/// Login Page, We can retrieve for configuration file (Web.Config)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; loginPage    = &lt;span style="color:#006080;"&gt;&amp;quot;Login.aspx&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        &lt;span style="color:#008000;"&gt;/// Session Timeout (Default 20 minutes)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; sessionTimeout  = HttpContext.Current.Session.Timeout;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        &lt;span style="color:#008000;"&gt;/// Timeout for Redirect to Login Page (10 milliseconds before)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; redirectTimeout = (sessionTimeout * 60000) - 10;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        &lt;span style="color:#008000;"&gt;/// JavaScript Code&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        StringBuilder javascript = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; StringBuilder();&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        javascript.Append(&lt;span style="color:#006080;"&gt;&amp;quot;var redirectTimeout;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        javascript.Append(&lt;span style="color:#006080;"&gt;&amp;quot;clearTimeout(redirectTimeout);&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        javascript.Append(String.Format(&lt;span style="color:#006080;"&gt;&amp;quot;setTimeout(\&amp;quot;window.location.href=&amp;#39;{0}&amp;#39;\&amp;quot;,{1});&amp;quot;&lt;/span&gt;, loginPage, redirectTimeout));&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        &lt;span style="color:#008000;"&gt;/// Register JavaScript Code on WebPage&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        page.ClientScript.RegisterStartupScript(page.GetType(),&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;                                                &lt;span style="color:#006080;"&gt;&amp;quot;RegisterRedirectOnSessionEndScript&amp;quot;&lt;/span&gt;,&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;                                                javascript.ToString(),&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;                                                &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    }&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;El script b&amp;aacute;sicamente lo que hace es:&lt;/p&gt;
&lt;p&gt;Obtener el tiempo en el que expira la sesi&amp;oacute;n del usuario (Session.TimeOut) y pasarlo a milisegundos, le resta 10 milisegundos para que se ejecute el redirect un poquito antes de que expire la sesi&amp;oacute;n, componer el script haciendo uso de las funciones &lt;strong&gt;clearTimeout&lt;/strong&gt; y &lt;strong&gt;setTimeout&lt;/strong&gt; de BLOCKED SCRIPT&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;clearTimeout(): &lt;/strong&gt;Resetear el time que hemos iniciado previamente, para que empieze de nuevo.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;setTimeout(): &lt;/strong&gt;Nos permite ejecutar c&amp;oacute;digo javascript pasado un tiempo especificado en milisegundos (Una cuenta atr&amp;aacute;s)&lt;/p&gt;
&lt;p&gt;y por &amp;uacute;ltimo registra el script en la p&amp;aacute;gina web.&lt;/p&gt;
&lt;p&gt;Ahora s&amp;oacute;lo falta hacer uso de nuestro nuevo m&amp;eacute;todo:&lt;/p&gt;
&lt;div&gt;
&lt;div style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Web;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Web.UI;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Web.UI.WebControls;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;partial&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; _Default : System.Web.UI.Page &lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;{&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#008000;"&gt;/// Handles the Load event of the Page control.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#008000;"&gt;/// &amp;lt;param name=&amp;quot;sender&amp;quot;&amp;gt;The source of the event.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#008000;"&gt;/// &amp;lt;param name=&amp;quot;e&amp;quot;&amp;gt;The &amp;lt;see cref=&amp;quot;System.EventArgs&amp;quot;/&amp;gt; instance containing the event data.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    {&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        Page.RegisterRedirectOnSessionEndScript();&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    }&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;y esperar (Dependiendo del Timeout que tengas configurado, yo le pongo un minuto para no esperar mucho) a que nos redirija a nuestra p&amp;aacute;gina de login (En mi caso Login.aspx)&lt;/p&gt;
&lt;p&gt;&lt;span style="color:#ff0000;"&gt;&lt;strong&gt;Editado (Usando una MasterPage por el comentario de Arturo)&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Web;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Web.UI;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; System.Web.UI.WebControls;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;partial&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; MasterPage : System.Web.UI.MasterPage&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;{&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#008000;"&gt;/// Handles the Load event of the Page control.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#008000;"&gt;/// &amp;lt;param name=&amp;quot;sender&amp;quot;&amp;gt;The source of the event.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#008000;"&gt;/// &amp;lt;param name=&amp;quot;e&amp;quot;&amp;gt;The &amp;lt;see cref=&amp;quot;System.EventArgs&amp;quot;/&amp;gt; instance containing the event data.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    &lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    {&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;        Page.RegisterRedirectOnSessionEndScript();&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;    }&lt;/pre&gt;
&lt;pre style="line-height:12pt;background-color:white;margin:0em;width:100%;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0px;"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Gracias por el comentario Arturo.&lt;/p&gt;
&lt;p&gt;Salu2&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://geeks.ms/aggbug.aspx?PostID=149483" width="1" height="1"&gt;</description><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+2.0/default.aspx">ASP.NET 2.0</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+3.5/default.aspx">ASP.NET 3.5</category></item><item><title>HOW TO – Creando nuestro propio DataControlField</title><link>http://geeks.ms/blogs/lruiz/archive/2009/02/18/how-to-creando-nuestro-propio-datacontrolfield.aspx</link><pubDate>Wed, 18 Feb 2009 16:43:00 GMT</pubDate><guid isPermaLink="false">2a2e7ade-7474-448b-9de5-1515d8bb7d1b:143004</guid><dc:creator>Luis Ruiz Pavón</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://geeks.ms/blogs/lruiz/rsscomments.aspx?PostID=143004</wfw:commentRss><comments>http://geeks.ms/blogs/lruiz/archive/2009/02/18/how-to-creando-nuestro-propio-datacontrolfield.aspx#comments</comments><description>&lt;p&gt;Revisando unos WireFrames que se le han entregado al cliente y cuyos WebParts los estoy desarrollando yo, me he encontrado&amp;nbsp; en unos de ellos que se quer&amp;iacute;a mostrar una imagen en la celda de un SPGridView para que el usuario al situarse sobre ella le muestre un texto descriptivo que se carga de una propiedad.&lt;/p&gt;
&lt;p&gt;No tendr&amp;iacute;a que haber ning&amp;uacute;n problema, usamos un ImageField y listo, no? pero: &lt;/p&gt;
&lt;p&gt;&amp;iquest;Y s&amp;iacute; necesitamos a&amp;ntilde;adirle un ToolTip con el valor de otra propiedad del DataBinder? &lt;/p&gt;
&lt;p&gt;&amp;iquest;Y s&amp;iacute; adem&amp;aacute;s en el DataBinder no existe dicha imagen como enlace de datos? &lt;/p&gt;
&lt;p&gt;La soluci&amp;oacute;n: que tenemos que crearnos el nuestro propio. As&amp;iacute; que vamos a ver como nos crearnos nuestro propio DataControlField. Para empezar lo primero es heredar de la clase &lt;a href="http://msdn.microsoft.com/es-es/library/system.web.ui.webcontrols.datacontrolfield(VS.80).aspx"&gt;DataControlField&lt;/a&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; ExtendedImageField : DataControlField&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Una vez hecho podemos agregar nuestras propiedades (Si las necesitamos):&lt;/p&gt;
&lt;div&gt;
&lt;div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#cc6633;"&gt;#region&lt;/span&gt; Propiedades&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// Gets or sets the image URL.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;value&amp;gt;The image URL.&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; ImageUrl&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;{&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    get { &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; _imageUrl; }&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    set { _imageUrl = &lt;span style="color:#0000ff;"&gt;value&lt;/span&gt;; }&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;}&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// Gets or sets the name of the property.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;value&amp;gt;The name of the property.&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; PropertyName&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;{&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    get { &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; _propertyName; }&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    set { _propertyName = &lt;span style="color:#0000ff;"&gt;value&lt;/span&gt;; }&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;}&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#cc6633;"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;En mi caso. estas propiedades son para poner una imagen al control y de que propiedad del DataBinder queremos obtener informaci&amp;oacute;n para ponerla en el ToolTip.&lt;/p&gt;
&lt;p&gt;A continuaci&amp;oacute;n necesitamos sobreescribir 2 m&amp;eacute;todos. El primero &lt;strong&gt;CreateField&lt;/strong&gt;:&lt;/p&gt;
&lt;div&gt;
&lt;div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// When overridden in a derived class, creates an empty &amp;lt;see cref=&amp;quot;T:System.Web.UI.WebControls.DataControlField&amp;quot;/&amp;gt;-derived object.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// An empty &amp;lt;see cref=&amp;quot;T:System.Web.UI.WebControls.DataControlField&amp;quot;/&amp;gt;-derived object.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; DataControlField CreateField()&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;{&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; ExtendedImageField();&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;para devolver nuestro tipo (&lt;strong&gt;ExtendedImageField&lt;/strong&gt;) y acto seguido sobreescribimos &lt;strong&gt;InitializeCell&lt;/strong&gt; y creamos un evento:&lt;/p&gt;
&lt;div&gt;
&lt;div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// Adds text or controls to a cell&amp;#39;s controls collection.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;param name=&amp;quot;cell&amp;quot;&amp;gt;A &amp;lt;see cref=&amp;quot;T:System.Web.UI.WebControls.DataControlFieldCell&amp;quot;/&amp;gt; that contains the text or controls of the &amp;lt;see cref=&amp;quot;T:System.Web.UI.WebControls.DataControlField&amp;quot;/&amp;gt;.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;param name=&amp;quot;cellType&amp;quot;&amp;gt;One of the &amp;lt;see cref=&amp;quot;T:System.Web.UI.WebControls.DataControlCellType&amp;quot;/&amp;gt; values.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;param name=&amp;quot;rowState&amp;quot;&amp;gt;One of the &amp;lt;see cref=&amp;quot;T:System.Web.UI.WebControls.DataControlRowState&amp;quot;/&amp;gt; values, specifying the state of the row that contains the &amp;lt;see cref=&amp;quot;T:System.Web.UI.WebControls.DataControlFieldCell&amp;quot;/&amp;gt;.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;param name=&amp;quot;rowIndex&amp;quot;&amp;gt;The index of the row that the &amp;lt;see cref=&amp;quot;T:System.Web.UI.WebControls.DataControlFieldCell&amp;quot;/&amp;gt; is contained in.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; InitializeCell(DataControlFieldCell cell, DataControlCellType cellType, DataControlRowState rowState, &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; rowIndex)&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;{&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    &lt;span style="color:#0000ff;"&gt;base&lt;/span&gt;.InitializeCell(cell, cellType, rowState, rowIndex);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (cellType == DataControlCellType.DataCell)&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    {&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;        cell.DataBinding += &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; EventHandler(OnBindingField);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    }&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;}&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// Called when [binding field].&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;param name=&amp;quot;sender&amp;quot;&amp;gt;The sender.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;param name=&amp;quot;e&amp;quot;&amp;gt;The &amp;lt;see cref=&amp;quot;System.EventArgs&amp;quot;/&amp;gt; instance containing the event data.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; OnBindingField(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;{&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    Control target = (Control)sender;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    &lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    TableCell tCell = target &lt;span style="color:#0000ff;"&gt;as&lt;/span&gt; TableCell;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (tCell != &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    {&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;        tCell.Attributes.Add(&lt;span style="color:#006080;"&gt;&amp;quot;valign&amp;quot;&lt;/span&gt;, &lt;span style="color:#006080;"&gt;&amp;quot;center&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;        &lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; dataItem = DataBinder.GetDataItem(target.NamingContainer);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;        &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; _tooltipText = (&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;)DataBinder.GetPropertyValue(dataItem, _propertyName);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;        &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (!String.IsNullOrEmpty(_tooltipText))&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;        {&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;            Image image = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; Image();&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;            image.ImageUrl = _imageUrl;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;            image.ToolTip = _tooltipText;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;            target.Controls.Add(image);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;        }&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    }&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;En el primero (&lt;strong&gt;InitializeCell&lt;/strong&gt;) lo que hacemos es comprobar que tipo de celda se est&amp;aacute; inicializando ya que tenemos 3 tipos posibles:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Header &lt;/li&gt;
&lt;li&gt;Footer &lt;/li&gt;
&lt;li&gt;DataCell &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/yc8taz9h.aspx" title="http://msdn.microsoft.com/en-us/library/yc8taz9h.aspx"&gt;http://msdn.microsoft.com/en-us/library/yc8taz9h.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;y comprobamos que es del tipo &lt;strong&gt;DataControlCellType.DataCell&lt;/strong&gt; (Las que tienen los controles y los datos) para suscribirmos a su evento &lt;strong&gt;DataBinding&lt;/strong&gt; y ah&amp;iacute; entra en juego el evento creado &lt;strong&gt;OnBindingField&lt;/strong&gt;, en el que hacemos un cast del control que viene por par&amp;aacute;metro a &lt;strong&gt;TableCell&lt;/strong&gt; usando la palabra reservada &lt;a href="http://msdn.microsoft.com/es-es/library/cscsdfbt(VS.80).aspx"&gt;as&lt;/a&gt; y sino no es nulo, obtenemos mediante el nombre de la propiedad que le a&amp;ntilde;adimos al control el contenido de la propiedad del &lt;strong&gt;DataBinder&lt;/strong&gt;, que en el caso de que no sea ni nula ni vacia, nos creamos un control imagen, al que le a&amp;ntilde;adimos sus propiedades ImageUrl con la que tiene nuestro control y el ToolTip con el valor de la propiedad del DataBinder que hemos recogido.&lt;/p&gt;
&lt;p&gt;Con esto hemos conseguido nuestro objetivo :)&lt;/p&gt;
&lt;p&gt;Esto es todo!!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://geeks.ms/aggbug.aspx?PostID=143004" width="1" height="1"&gt;</description><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/Web/default.aspx">Web</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+2.0/default.aspx">ASP.NET 2.0</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/MOSS+2007/default.aspx">MOSS 2007</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+3.5/default.aspx">ASP.NET 3.5</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/Controles/default.aspx">Controles</category></item><item><title>Microsoft Code Analysis Tool .NET (CAT.NET) v1 CTP</title><link>http://geeks.ms/blogs/lruiz/archive/2009/02/10/microsoft-code-analysis-tool-net-cat-net-v1-ctp.aspx</link><pubDate>Tue, 10 Feb 2009 14:52:00 GMT</pubDate><guid isPermaLink="false">2a2e7ade-7474-448b-9de5-1515d8bb7d1b:142500</guid><dc:creator>Luis Ruiz Pavón</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://geeks.ms/blogs/lruiz/rsscomments.aspx?PostID=142500</wfw:commentRss><comments>http://geeks.ms/blogs/lruiz/archive/2009/02/10/microsoft-code-analysis-tool-net-cat-net-v1-ctp.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=0178e2ef-9da8-445e-9348-c93f24cc9f9d&amp;amp;displaylang=en"&gt;CAT.NET&lt;/a&gt; es un Add-in para Visual Studio, qu&amp;eacute; tambi&amp;eacute;n podemos utilizar a trav&amp;eacute;s de la l&amp;iacute;nea de comandos, para analizar el c&amp;oacute;digo de nuestras aplicaciones y detectar vulnerabilidades ya conocidas como Cross Site Scripting, SQL Injection, Process Command Injection, File Canonicalization, Exception Information, LDAP Injection, XPATH Injection y Redirection to User Controlled Site.&lt;/p&gt;
&lt;p&gt;Lo he instalado y he decido probarlo con un mini-cutre web site:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/catnet_5F00_0261BB3F.jpg"&gt;&lt;img border="0" width="198" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/catnet_5F00_thumb_5F00_6AE7070D.jpg" alt="catnet" height="169" style="border-right:0px;border-top:0px;display:inline;border-left:0px;border-bottom:0px;" title="catnet" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;La p&amp;aacute;gina UserInfo.aspx es vulnerable a SQL Injection:&lt;/p&gt;
&lt;div&gt;
&lt;div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color:#0000ff;"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    {&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;        &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (!Page.IsPostBack)&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;        {&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;            User user = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; User();&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;            &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; _userid = Request.QueryString[&lt;span style="color:#006080;"&gt;&amp;quot;userid&amp;quot;&lt;/span&gt;];&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;            &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; (SqlConnection conexion = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; SqlConnection(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;quot;&lt;/span&gt;))&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;            {&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;                conexion.Open();&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;                &lt;span style="color:#008000;"&gt;///Pruebas SQL Injection CAT.NET&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;                SqlCommand comando = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; SqlCommand();&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;                comando.CommandText = &lt;span style="color:#006080;"&gt;&amp;quot;SELECT Name, Surname FROM Users WHERE Id = &amp;#39;&amp;quot;&lt;/span&gt; + _userid + &lt;span style="color:#006080;"&gt;&amp;quot;&amp;#39;&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;                comando.Connection = conexion;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;                IDataReader reader = comando.ExecuteReader();&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;                &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (reader.Read())&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;                {&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;                    user.Id = _userid;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;                    user.Name = reader.GetString(0);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;                    user.Surname = reader.GetString(1);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;                }&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;            }&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;        }&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Y en el Handler File.aspx he puesto el c&amp;oacute;digo de la famosa vulnerabilidad de canonicalizaci&amp;oacute;n de BlogEngine para ver s&amp;iacute; tambi&amp;eacute;n lo detecta:&lt;/p&gt;
&lt;div&gt;
&lt;div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; ProcessRequest(HttpContext context)&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    {&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;        &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (!&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt;.IsNullOrEmpty(context.Request.QueryString[&lt;span style="color:#006080;"&gt;&amp;quot;file&amp;quot;&lt;/span&gt;]))&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;        {&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;            &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; fileName = context.Request.QueryString[&lt;span style="color:#006080;"&gt;&amp;quot;file&amp;quot;&lt;/span&gt;];&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;            &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; folder = &lt;span style="color:#006080;"&gt;&amp;quot;/files/&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;            &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (System.IO.File.Exists(context.Server.MapPath(folder) + fileName))&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;            {&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;                context.Response.AppendHeader(&lt;span style="color:#006080;"&gt;&amp;quot;Content-Disposition&amp;quot;&lt;/span&gt;, &lt;span style="color:#006080;"&gt;&amp;quot;attachment; filename=&amp;quot;&lt;/span&gt; + context.Server.UrlEncode(fileName));&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;                context.Response.Cache.SetCacheability(HttpCacheability.NoCache);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;                context.Server.Transfer(folder + fileName, &lt;span style="color:#0000ff;"&gt;false&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;            }&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;            &lt;span style="color:#0000ff;"&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;            {&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;                context.Response.Status = &lt;span style="color:#006080;"&gt;&amp;quot;404 Bad Request&amp;quot;&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;            }&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;        }&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    } &lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Arrancamos CAT.NET:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/catnet2_5F00_69363B39.jpg"&gt;&lt;img border="0" width="293" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/catnet2_5F00_thumb_5F00_04AB1770.jpg" alt="catnet2" height="506" style="border-right:0px;border-top:0px;display:inline;border-left:0px;border-bottom:0px;" title="catnet2" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Ejecutamos y esperamos los resultados:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/catnet3_5F00_19D91D18.jpg"&gt;&lt;img border="0" width="644" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/catnet3_5F00_thumb_5F00_7D7BB52A.jpg" alt="catnet3" height="370" style="border-right:0px;border-top:0px;display:inline;border-left:0px;border-bottom:0px;" title="catnet3" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Como se puede observar, ha detectado la vulnerabilidad de SQL Injection, indicando las l&amp;iacute;neas donde se encuentran dichas vulnerabilidades aunque la del Handler no.&lt;/p&gt;
&lt;p&gt;Podemos acceder a los ficheros de Reglas de CAT.NET, a&amp;ntilde;adir nuevas reglas, modificar las existentes, habilitarlas/deshabilitarlas&amp;hellip;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/catnet4_5F00_3A5036FD.jpg"&gt;&lt;img border="0" width="449" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/catnet4_5F00_thumb_5F00_5D5082A0.jpg" alt="catnet4" height="410" style="border-right:0px;border-top:0px;display:inline;border-left:0px;border-bottom:0px;" title="catnet4" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Seguir&amp;eacute; investigando y a partir de ahora utilizar&amp;eacute; esta herramienta para auditar m&amp;iacute; c&amp;oacute;digo.&lt;/p&gt;
&lt;p&gt;Esto es todo!!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://geeks.ms/aggbug.aspx?PostID=142500" width="1" height="1"&gt;</description><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/Debugging/default.aspx">Debugging</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+2.0/default.aspx">ASP.NET 2.0</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/Microsoft/default.aspx">Microsoft</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+3.5/default.aspx">ASP.NET 3.5</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/Add-in/default.aspx">Add-in</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/Seguridad/default.aspx">Seguridad</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/Visual+Studio/default.aspx">Visual Studio</category></item><item><title>HOW TO – (MOSS 2007) Crear nuestro propio ToolPart</title><link>http://geeks.ms/blogs/lruiz/archive/2009/02/09/how-to-moss-2007-crear-nuestro-propio-toolpart.aspx</link><pubDate>Mon, 09 Feb 2009 14:30:00 GMT</pubDate><guid isPermaLink="false">2a2e7ade-7474-448b-9de5-1515d8bb7d1b:142357</guid><dc:creator>Luis Ruiz Pavón</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://geeks.ms/blogs/lruiz/rsscomments.aspx?PostID=142357</wfw:commentRss><comments>http://geeks.ms/blogs/lruiz/archive/2009/02/09/how-to-moss-2007-crear-nuestro-propio-toolpart.aspx#comments</comments><description>&lt;p&gt;Desarrollando unos WebPart para el proyecto en el que estoy actualmente, necesitaba a&amp;ntilde;adir una propiedad a un WebPart para permitir s&amp;oacute;lo su visibilidad a ciertos perfiles. Estos perfiles los suministra una aplicaci&amp;oacute;n que se encarga de la seguridad de las aplicaciones.&lt;/p&gt;
&lt;p&gt;Para otros caso me vale una Enum como fuente de datos (Ve&amp;aacute;se Tipo de Objeto, Tipo de Barra&amp;hellip;) pero para este caso no, as&amp;iacute; que tuve que crearme mi propio ToolPart como se muestra en la imagen:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/toolpart1_5F00_10916B6D.jpg"&gt;&lt;img border="0" width="260" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/toolpart1_5F00_thumb_5F00_0CC3A0D0.jpg" alt="toolpart1" height="511" style="border-top-width:0px;display:inline;border-left-width:0px;border-bottom-width:0px;border-right-width:0px;" title="toolpart1" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;En concreto el desplegable en cuesti&amp;oacute;n es el de &lt;strong&gt;Perfil Permitido.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Para crearnos nuestro propio ToolPart, lo primero es crearnos una clase que herede de &lt;strong&gt;ToolPart&lt;/strong&gt; (&lt;strong&gt;Microsoft.SharePoint.WebPartPages.ToolPart&lt;/strong&gt;):&lt;/p&gt;
&lt;div&gt;
&lt;div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#606060;"&gt;   &lt;/span&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; ExtendedWorkLoadToolPart : ToolPart&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Lo siguiente ser&amp;aacute; sobreescribir los m&amp;eacute;todos &lt;strong&gt;CreateChildControls&lt;/strong&gt; y &lt;strong&gt;RenderToolPart&lt;/strong&gt;:&lt;/p&gt;
&lt;div&gt;
&lt;div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; CreateChildControls()&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;{&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    &lt;span style="color:#0000ff;"&gt;base&lt;/span&gt;.CreateChildControls();&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    &lt;span style="color:#008000;"&gt;/// A&amp;ntilde;adir nuestros controles  &lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// Sends the tool part content to the specified HtmlTextWriter object, &lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// which writes the content to be rendered on the client.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;param name=&amp;quot;output&amp;quot;&amp;gt;The HtmlTextWriter object that receives the tool part content.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; RenderToolPart(System.Web.UI.HtmlTextWriter output)&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;{&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    &lt;span style="color:#008000;"&gt;// Establish a reference to the Web Part.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    WorkLoadWebPart workLoadWebPart =&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;        (WorkLoadWebPart)&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ParentToolPane.SelectedWebPart;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;table width=\&amp;quot;100%\&amp;quot; cellspacing=\&amp;quot;0\&amp;quot; cellpadding=\&amp;quot;2\&amp;quot;&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td colspan=\&amp;quot;2\&amp;quot;&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _lblDataHeader.Text = SPUtility.GetLocalizedString(&lt;span style="color:#006080;"&gt;&amp;quot;$Resources:webpart_lblDataHeader_text&amp;quot;&lt;/span&gt;, &lt;span style="color:#006080;"&gt;&amp;quot;company&amp;quot;&lt;/span&gt;, SPContext.Current.Web.Language);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    _lblDataHeader.Font.Bold = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _lblDataHeader.RenderControl(output);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;hr&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _lblObjectType.Text = SPUtility.GetLocalizedString(&lt;span style="color:#006080;"&gt;&amp;quot;$Resources:webpart_lblObjectType_text&amp;quot;&lt;/span&gt;, &lt;span style="color:#006080;"&gt;&amp;quot;company&amp;quot;&lt;/span&gt;, SPContext.Current.Web.Language);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    _lblObjectType.RenderControl(output);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    _ddlObjectType.SelectedValue = Enum.GetName(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(EnumObjectType), workLoadWebPart.TipoObjeto);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _ddlObjectType.RenderControl(output);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _lblActiveUser.Text = SPUtility.GetLocalizedString(&lt;span style="color:#006080;"&gt;&amp;quot;$Resources:webpart_lblActiveUser_text&amp;quot;&lt;/span&gt;, &lt;span style="color:#006080;"&gt;&amp;quot;company&amp;quot;&lt;/span&gt;, SPContext.Current.Web.Language);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    _lblActiveUser.RenderControl(output);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    _chkActiveUser.Checked = workLoadWebPart.UsuarioActivo;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _chkActiveUser.RenderControl(output);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _lblDelimerChar.Text = SPUtility.GetLocalizedString(&lt;span style="color:#006080;"&gt;&amp;quot;$Resources:webpart_lblDelimerChar_text&amp;quot;&lt;/span&gt;, &lt;span style="color:#006080;"&gt;&amp;quot;company&amp;quot;&lt;/span&gt;, SPContext.Current.Web.Language);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    _lblDelimerChar.RenderControl(output);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    _txtDelimiterChar.Text = workLoadWebPart.DelimitadorUsurios.ToString();&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _txtDelimiterChar.RenderControl(output);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td colspan=\&amp;quot;2\&amp;quot;&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _lblVariosHeader.Text = SPUtility.GetLocalizedString(&lt;span style="color:#006080;"&gt;&amp;quot;$Resources:webpart_lblVariosHeader_text&amp;quot;&lt;/span&gt;, &lt;span style="color:#006080;"&gt;&amp;quot;company&amp;quot;&lt;/span&gt;, SPContext.Current.Web.Language);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    _lblVariosHeader.Font.Bold = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _lblVariosHeader.RenderControl(output);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;hr&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _lblBarType.Text = SPUtility.GetLocalizedString(&lt;span style="color:#006080;"&gt;&amp;quot;$Resources:webpart_lblBarType_text&amp;quot;&lt;/span&gt;, &lt;span style="color:#006080;"&gt;&amp;quot;company&amp;quot;&lt;/span&gt;, SPContext.Current.Web.Language);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    _lblBarType.RenderControl(output);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    _ddlBarType.SelectedValue = Enum.GetName(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(EnumBarType), workLoadWebPart.TipoBarra);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _ddlBarType.RenderControl(output);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _lblShowLabels.Text = SPUtility.GetLocalizedString(&lt;span style="color:#006080;"&gt;&amp;quot;$Resources:webpart_lblShowLabels_text&amp;quot;&lt;/span&gt;, &lt;span style="color:#006080;"&gt;&amp;quot;company&amp;quot;&lt;/span&gt;, SPContext.Current.Web.Language);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    _lblShowLabels.RenderControl(output);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    _chkShowLabels.Checked = workLoadWebPart.MostrarEtiquetas;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _chkShowLabels.RenderControl(output);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _lblPlacePecentage.Text = SPUtility.GetLocalizedString(&lt;span style="color:#006080;"&gt;&amp;quot;$Resources:webpart_lblPlacePecentage_text&amp;quot;&lt;/span&gt;, &lt;span style="color:#006080;"&gt;&amp;quot;company&amp;quot;&lt;/span&gt;, SPContext.Current.Web.Language);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    _lblPlacePecentage.RenderControl(output);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    _ddlPlacePercentage.SelectedValue = Enum.GetName(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(EnumPlacePercentage), workLoadWebPart.UbicacionPorcentaje);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _ddlPlacePercentage.RenderControl(output);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td colspan=\&amp;quot;2\&amp;quot;&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    _lblSecurityHeader.Text = SPUtility.GetLocalizedString(&lt;span style="color:#006080;"&gt;&amp;quot;$Resources:webpart_lblSecurityHeader_text&amp;quot;&lt;/span&gt;, &lt;span style="color:#006080;"&gt;&amp;quot;company&amp;quot;&lt;/span&gt;, SPContext.Current.Web.Language);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _lblSecurityHeader.Font.Bold = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    _lblSecurityHeader.RenderControl(output);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;hr&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    _lblProfiles.Text = SPUtility.GetLocalizedString(&lt;span style="color:#006080;"&gt;&amp;quot;$Resources:webpart_lblProfiles_text&amp;quot;&lt;/span&gt;, &lt;span style="color:#006080;"&gt;&amp;quot;company&amp;quot;&lt;/span&gt;, SPContext.Current.Web.Language);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _lblProfiles.RenderControl(output);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    _ddlProfiles.SelectedValue = workLoadWebPart.PerfilPermitido;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    _ddlProfiles.RenderControl(output);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    output.Write(&lt;span style="color:#006080;"&gt;&amp;quot;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Vamos a fijarnos en esta l&amp;iacute;nea:&lt;/p&gt;
&lt;div&gt;
&lt;div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;// Establish a reference to the Web Part.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;WorkLoadWebPart customWebPartEx1 =&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;        (WorkLoadWebPart)&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ParentToolPane.SelectedWebPart;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;En ella lo que hacemos es obtener la referencia al WebPart que est&amp;aacute; usando la ToolPart, para acceder a sus propiedades y poder cargar los datos en los controles antes de renderizarlos. &lt;/p&gt;
&lt;p&gt;Para finzalizar nuestra ToolPart, nos falta almacenar los valores de los controles de la ToolPart en las propiedades de nuestro WebPart. Para ellos sobreescribimos el m&amp;eacute;todo &lt;strong&gt;ApplyChanges&lt;/strong&gt;, que ser&amp;aacute; llamado cuando se pulse el bot&amp;oacute;n OK o Aplicar, cuando modificamos las propiedades del WebPart:&lt;/p&gt;
&lt;div&gt;
&lt;div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// Called when the user clicks the OK or the Apply button in the tool pane.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; ApplyChanges()&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;{&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    &lt;span style="color:#008000;"&gt;// Establish a reference to the Web Part.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    WorkLoadWebPart workLoadWebPart =&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;        (WorkLoadWebPart)&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;.ParentToolPane.SelectedWebPart;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    workLoadWebPart.UbicacionPorcentaje = (EnumPlacePercentage)Enum.Parse(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(EnumPlacePercentage), _ddlPlacePercentage.SelectedValue);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    workLoadWebPart.TipoBarra = (EnumBarType)Enum.Parse(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(EnumBarType), _ddlBarType.SelectedValue);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    workLoadWebPart.PerfilPermitido = _ddlProfiles.SelectedValue;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    workLoadWebPart.TipoObjeto = (EnumObjectType)Enum.Parse(&lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(EnumObjectType), _ddlObjectType.SelectedValue);&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    workLoadWebPart.MostrarEtiquetas = _chkShowLabels.Checked;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;    workLoadWebPart.UsuarioActivo = _chkActiveUser.Checked;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    workLoadWebPart.DelimitadorUsurios = _txtDelimiterChar.Text.ToCharArray()[0];&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Por &amp;uacute;ltimo, falta que nuestro WebPart utilice la ToolPart que acabamos de crear. En el c&amp;oacute;digo de nuestro WebPart sobreescribimos el m&amp;eacute;todo &lt;strong&gt;GetToolParts&lt;/strong&gt;:&lt;/p&gt;
&lt;div&gt;
&lt;div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// Determines which tool parts are displayed in the tool pane of the Web-based Web Part design user interface, and the order in which they are displayed.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// An array of type &amp;lt;see cref=&amp;quot;T:Microsoft.SharePoint.WebPartPages.ToolPart&amp;quot;&amp;gt;&amp;lt;/see&amp;gt; that determines which tool parts will be displayed in the tool pane. If a Web Part that implements one or more custom properties does not override the &amp;lt;see cref=&amp;quot;M:Microsoft.SharePoint.WebPartPages.WebPart.GetToolParts&amp;quot;&amp;gt;&amp;lt;/see&amp;gt; method, the base class method will return an instance of the &amp;lt;see cref=&amp;quot;T:Microsoft.SharePoint.WebPartPages.WebPartToolPart&amp;quot;&amp;gt;&amp;lt;/see&amp;gt; class and an instance of the &amp;lt;see cref=&amp;quot;T:Microsoft.SharePoint.WebPartPages.CustomPropertyToolPart&amp;quot;&amp;gt;&amp;lt;/see&amp;gt; class. An instance of the &amp;lt;see cref=&amp;quot;T:Microsoft.SharePoint.WebPartPages.WebPartToolPart&amp;quot;&amp;gt;&amp;lt;/see&amp;gt; class displays a tool part for working with the properties provided by the WebPart base class. An instance of the &amp;lt;see cref=&amp;quot;T:Microsoft.SharePoint.WebPartPages.CustomPropertyToolPart&amp;quot;&amp;gt;&amp;lt;/see&amp;gt; class displays a built-in tool part for working custom Web Part properties, as long as the custom property is of one of the types supported by that tool part. The supported types are: String, Boolean, Integer, DateTime, or Enum.&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#008000;"&gt;/// &amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;[SharePointPermission(SecurityAction.Demand, ObjectModel = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;)]&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; ToolPart[] GetToolParts()&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;{&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:#f4f4f4;border-style:none;padding:0px;"&gt;    &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; ToolPart[] { &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; WebPartToolPart(), &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; ExtendedWorkLoadToolPart() };&lt;/pre&gt;
&lt;pre style="font-size:8pt;margin:0em;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;background-color:white;border-style:none;padding:0px;"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;A&amp;ntilde;adimos a parte de la &lt;strong&gt;ToolPart&lt;/strong&gt; por defecto, nuestra ToolPart (&lt;strong&gt;ExtendedWorkLoadToolPart&lt;/strong&gt;).&lt;/p&gt;
&lt;p&gt;Y esto es todo!!!&lt;/p&gt;
&lt;p&gt;PD: He a&amp;ntilde;adido un c&amp;oacute;digo de ejemplo aunque no es del art&amp;iacute;culo ;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://geeks.ms/aggbug.aspx?PostID=142357" width="1" height="1"&gt;</description><enclosure url="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Components.PostAttachments/00.00.14.23.57/ExtendedUserInfoToolPart.zip" length="2348" type="application/x-zip-compressed" /><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/SharePoint/default.aspx">SharePoint</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/Web/default.aspx">Web</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+2.0/default.aspx">ASP.NET 2.0</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+3.5/default.aspx">ASP.NET 3.5</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/MOSS/default.aspx">MOSS</category></item><item><title>HOW TO: Obtener librerías de la GAC</title><link>http://geeks.ms/blogs/lruiz/archive/2009/02/03/how-to-obtener-librer-237-as-de-la-gac.aspx</link><pubDate>Tue, 03 Feb 2009 17:51:00 GMT</pubDate><guid isPermaLink="false">2a2e7ade-7474-448b-9de5-1515d8bb7d1b:141880</guid><dc:creator>Luis Ruiz Pavón</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://geeks.ms/blogs/lruiz/rsscomments.aspx?PostID=141880</wfw:commentRss><comments>http://geeks.ms/blogs/lruiz/archive/2009/02/03/how-to-obtener-librer-237-as-de-la-gac.aspx#comments</comments><description>&lt;p&gt;Mucho ha llovido desde mi &amp;uacute;ltimo post, pero entre trabajo y la preparaci&amp;oacute;n de mi boda, no he tenido mucho tiempo libre.&lt;/p&gt;
&lt;p&gt;Hace un par de meses ayudando a un compa&amp;ntilde;ero con una aplicaci&amp;oacute;n web, tuve la necesidad de desplegar las dlls del ReportViewer en el hosting que hab&amp;iacute;an contratado para que pudieran visualizar unos reports. Existe un paquete de distribuci&amp;oacute;n &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=8a166cac-758d-45c8-b637-dd7726e61367&amp;amp;DisplayLang=en" title="http://www.microsoft.com/downloads/details.aspx?FamilyID=8a166cac-758d-45c8-b637-dd7726e61367&amp;amp;DisplayLang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyID=8a166cac-758d-45c8-b637-dd7726e61367&amp;amp;DisplayLang=en&lt;/a&gt;, pero en nuestro caso no era nuestra opci&amp;oacute;n, ya que el hosting era de terceros.&lt;/p&gt;
&lt;p&gt;Para qui&amp;eacute;n no lo sepa, las librer&amp;iacute;as se pueden encontrar en C:\Program Files\Microsoft Visual Studio X.0\ReportViewer, pero una vez desplegado os encontrar&amp;eacute;is que os falta la librer&amp;iacute;a Microsoft.ReportViewer.ProcessingObjectModel.dll, que concretamente se encuentra en la GAC instalada.&lt;/p&gt;
&lt;p&gt;Para obtenerla ejecutamos el comando:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Subst &amp;lt;Unidad&amp;gt;: %windir%\assembly&lt;/strong&gt; por ejemplo &lt;strong&gt;Subst y: %windir%\assembly&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/gac_5F00_26CA1904.jpg"&gt;&lt;img border="0" width="644" src="http://geeks.ms/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/lruiz/gac_5F00_thumb_5F00_4D687F84.jpg" alt="gac" height="275" style="border-right:0px;border-top:0px;display:inline;border-left:0px;border-bottom:0px;" title="gac" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Una vez hecho esto, tenemos acceso completo a las librer&amp;iacute;as, que en mi caso est&amp;aacute;n en:&lt;/p&gt;
&lt;p&gt;Y:\GAC_MSIL\Microsoft.ReportViewer.ProcessingObjectModel\8.0.0.0__b03f5f7f11d50a3a para la versi&amp;oacute;n de VS 2005&lt;/p&gt;
&lt;p&gt;Y:\GAC_MSIL\Microsoft.ReportViewer.ProcessingObjectModel\9.0.0.0__b03f5f7f11d50a3a para la versi&amp;oacute;n de VS 2008&lt;/p&gt;
&lt;p&gt;Esto es todo!!!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://geeks.ms/aggbug.aspx?PostID=141880" width="1" height="1"&gt;</description><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/NET/default.aspx">NET</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+2.0/default.aspx">ASP.NET 2.0</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+3.5/default.aspx">ASP.NET 3.5</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/GAC/default.aspx">GAC</category></item><item><title>Acentos en Java Script alert y confirm</title><link>http://geeks.ms/blogs/lruiz/archive/2008/04/25/acentos-en-javascript-alert-y-confirm.aspx</link><pubDate>Fri, 25 Apr 2008 08:21:00 GMT</pubDate><guid isPermaLink="false">2a2e7ade-7474-448b-9de5-1515d8bb7d1b:84222</guid><dc:creator>Luis Ruiz Pavón</dc:creator><slash:comments>27</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://geeks.ms/blogs/lruiz/rsscomments.aspx?PostID=84222</wfw:commentRss><comments>http://geeks.ms/blogs/lruiz/archive/2008/04/25/acentos-en-javascript-alert-y-confirm.aspx#comments</comments><description>&lt;p&gt;Suele ser una pregunta frecuente en foros y newsgroup y la solución es sencilla. Cuando mostramos letras acentuadas,la letra ñ/Ñ en alertas javascript, en ciertas ocasiones y dependiendo de la codificación usada, utilización de AJAX, registrar scripts a través del ScriptManager en un UpdatePanel... suele verse un mensaje de este tipo:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/blogs/lruiz/WindowsLiveWriter/AcentosenJavaScriptalertyconfirm_91A7/confirm.jpg"&gt;&lt;img style="BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px;" height="127" alt="confirm" src="http://geeks.ms/blogs/lruiz/WindowsLiveWriter/AcentosenJavaScriptalertyconfirm_91A7/confirm_thumb.jpg" width="509" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;La solución es utilizar unicode:&lt;/p&gt;
&lt;p&gt;\u00e1 -&amp;gt; á &lt;br /&gt;\u00e9 -&amp;gt; é &lt;br /&gt;\u00ed -&amp;gt; í &lt;br /&gt;\u00f3 -&amp;gt; ó &lt;br /&gt;\u00fa -&amp;gt; ú &lt;br /&gt;\u00c1 -&amp;gt; Á &lt;br /&gt;\u00c9 -&amp;gt; É &lt;br /&gt;\u00cd -&amp;gt; Í &lt;br /&gt;\u00d3 -&amp;gt; Ó &lt;br /&gt;\u00da -&amp;gt; Ú &lt;br /&gt;\u00f1 -&amp;gt; ñ &lt;br /&gt;\u00d1 -&amp;gt; Ñ 
&lt;p&gt;Y el resultado: 
&lt;p&gt;&lt;a href="http://geeks.ms/blogs/lruiz/WindowsLiveWriter/AcentosenJavaScriptalertyconfirm_91A7/confirm2.jpg"&gt;&lt;img style="BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px;" height="130" alt="confirm2" src="http://geeks.ms/blogs/lruiz/WindowsLiveWriter/AcentosenJavaScriptalertyconfirm_91A7/confirm2_thumb.jpg" width="625" border="0" /&gt;&lt;/a&gt; 
&lt;p&gt;Salu2 &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://geeks.ms/aggbug.aspx?PostID=84222" width="1" height="1"&gt;</description><category domain="http://geeks.ms/blogs/lruiz/archive/tags/AJAX/default.aspx">AJAX</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/Web/default.aspx">Web</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/JavaScript/default.aspx">JavaScript</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+2.0/default.aspx">ASP.NET 2.0</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+3.5/default.aspx">ASP.NET 3.5</category></item><item><title>Dynamic Data Web Applications o como montar rápidamente una aplicación web con acceso a datos</title><link>http://geeks.ms/blogs/lruiz/archive/2008/04/10/dynamic-data-web-applications-o-como-montar-r-225-pidamente-una-aplicaci-243-n-web-con-acceso-a-datos.aspx</link><pubDate>Thu, 10 Apr 2008 13:01:00 GMT</pubDate><guid isPermaLink="false">2a2e7ade-7474-448b-9de5-1515d8bb7d1b:82886</guid><dc:creator>Luis Ruiz Pavón</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://geeks.ms/blogs/lruiz/rsscomments.aspx?PostID=82886</wfw:commentRss><comments>http://geeks.ms/blogs/lruiz/archive/2008/04/10/dynamic-data-web-applications-o-como-montar-r-225-pidamente-una-aplicaci-243-n-web-con-acceso-a-datos.aspx#comments</comments><description>&lt;p&gt;Ayer en casa me decidí a realizar unos Labs con las ASP.NET 3.5 extensions de acceso dinámico a datos siguiendo los quickstarts en inglés disponibles en:&lt;/p&gt;
&lt;p&gt;&lt;a title="http://quickstarts.asp.net/3-5-extensions/dyndata/default.aspx" href="http://quickstarts.asp.net/3-5-extensions/dyndata/default.aspx"&gt;http://quickstarts.asp.net/3-5-extensions/dyndata/default.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;para probar eso de montarte una pequeña aplicación de mantenimiento de una base de datos sencilla en poco tiempo y pensé en crear un pequeño tutorial en español:&lt;/p&gt;
&lt;p&gt;Lo primero que necesitamos es instalarnos las ASP.NET 3.5 Extensions Preview:&lt;/p&gt;
&lt;p&gt;&lt;a title="http://www.microsoft.com/downloads/details.aspx?FamilyId=A9C6BC06-B894-4B11-8300-35BD2F8FC908&amp;amp;displaylang=en" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=A9C6BC06-B894-4B11-8300-35BD2F8FC908&amp;amp;displaylang=en"&gt;http://www.microsoft.com/downloads/details.aspx?FamilyId=A9C6BC06-B894-4B11-8300-35BD2F8FC908&amp;amp;displaylang=en&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Una vez instaladas, creamos un proyecto &lt;strong&gt;Dynamic Data Web Application&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/blogs/lruiz/WindowsLiveWriter/DynamicDataWebApplicationsocomomontarrpi_D34A/Sin%20nombre_2.jpg"&gt;&lt;img style="BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px;" height="472" alt="Sin nombre" src="http://geeks.ms/blogs/lruiz/WindowsLiveWriter/DynamicDataWebApplicationsocomomontarrpi_D34A/Sin%20nombre_thumb.jpg" width="644" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Cuando se crea el proyecto y miramos su estructura, a primera vista llama la atención la carpeta &lt;strong&gt;App_Shared&lt;/strong&gt;:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/blogs/lruiz/WindowsLiveWriter/DynamicDataWebApplicationsocomomontarrpi_D34A/Sin%20nombre2_2.jpg"&gt;&lt;img style="BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px;" height="484" alt="Sin nombre2" src="http://geeks.ms/blogs/lruiz/WindowsLiveWriter/DynamicDataWebApplicationsocomomontarrpi_D34A/Sin%20nombre2_thumb.jpg" width="346" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;En la carpeta &lt;strong&gt;App_Shared&lt;/strong&gt; se encuentran las diferentes templates de páginas y campos (Data Pages y Data Fields) e imagenes que sirven para construir las páginas dinámicas. Entre las templates de páginas tenemos:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;ListDetailsTemplate.aspx&lt;/strong&gt;: Muestra la lista de filas de una tabla concreta y el detalle de sus elementos. Esta es la plantilla por defecto para todas las operaciones de datos (DynamicGridView + DynamicDetailsView).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DetailsTemplate.aspx&lt;/strong&gt;: Muestra el detalle de una fila de la tabla (DynamicDetailsView)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ListTemplate.aspx&lt;/strong&gt;: Muestra la lista de filas de una tabla concreta. Está pensada para trabajar junto con DetailsTemplate.&lt;/li&gt;&lt;/ol&gt;
&lt;p&gt;Una vez visto un poco por encima las diferentes templates vamos a hacer que todo esto funcione:&lt;/p&gt;
&lt;p&gt;Lo primero es crearnos un archivo&lt;strong&gt; LINQ to SQL Classes&lt;/strong&gt; de la base de datos Northwind que nos servirá como repositorio de nuestra aplicación:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/blogs/lruiz/WindowsLiveWriter/DynamicDataWebApplicationsocomomontarrpi_D34A/Sin%20nombre3_2.jpg"&gt;&lt;img style="BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px;" height="484" alt="Sin nombre3" src="http://geeks.ms/blogs/lruiz/WindowsLiveWriter/DynamicDataWebApplicationsocomomontarrpi_D34A/Sin%20nombre3_thumb.jpg" width="344" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Y por último sólo tenemos que actualizar el Web.Config para que nuestra aplicación lo consuma y para habilitar las plantillas dinámicas par que se generen de manera automática las páginas con los datos. Para ello abrimos el &lt;strong&gt;Web.Config&lt;/strong&gt; y buscamos esta línea:&lt;/p&gt;
&lt;div style="BORDER-RIGHT:gray 1px solid;PADDING-RIGHT:4px;BORDER-TOP:gray 1px solid;PADDING-LEFT:4px;FONT-SIZE:8pt;PADDING-BOTTOM:4px;MARGIN:20px 0px 10px;OVERFLOW:auto;BORDER-LEFT:gray 1px solid;WIDTH:97.5%;CURSOR:text;MAX-HEIGHT:200px;LINE-HEIGHT:12pt;PADDING-TOP:4px;BORDER-BOTTOM:gray 1px solid;FONT-FAMILY:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;BACKGROUND-COLOR:#f4f4f4;"&gt;
&lt;div style="PADDING-RIGHT:0px;PADDING-LEFT:0px;FONT-SIZE:8pt;PADDING-BOTTOM:0px;OVERFLOW:visible;WIDTH:100%;COLOR:black;BORDER-TOP-STYLE:none;LINE-HEIGHT:12pt;PADDING-TOP:0px;FONT-FAMILY:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;BORDER-RIGHT-STYLE:none;BORDER-LEFT-STYLE:none;BACKGROUND-COLOR:#f4f4f4;BORDER-BOTTOM-STYLE:none;"&gt;&lt;pre style="PADDING-RIGHT:0px;PADDING-LEFT:0px;FONT-SIZE:8pt;PADDING-BOTTOM:0px;MARGIN:0em;OVERFLOW:visible;WIDTH:100%;COLOR:black;BORDER-TOP-STYLE:none;LINE-HEIGHT:12pt;PADDING-TOP:0px;FONT-FAMILY:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;BORDER-RIGHT-STYLE:none;BORDER-LEFT-STYLE:none;BACKGROUND-COLOR:white;BORDER-BOTTOM-STYLE:none;"&gt;&lt;span style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR:#800000;"&gt;dynamicData&lt;/span&gt; &lt;span style="COLOR:#ff0000;"&gt;dataContextType&lt;/span&gt;&lt;span style="COLOR:#0000ff;"&gt;=&amp;quot;&amp;quot;&lt;/span&gt; &lt;span style="COLOR:#ff0000;"&gt;enableTemplates&lt;/span&gt;&lt;span style="COLOR:#0000ff;"&gt;=&amp;quot;false&amp;quot;&lt;/span&gt;&lt;span style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Y la actualizamos con esta información:&lt;/p&gt;
&lt;div style="BORDER-RIGHT:gray 1px solid;PADDING-RIGHT:4px;BORDER-TOP:gray 1px solid;PADDING-LEFT:4px;FONT-SIZE:8pt;PADDING-BOTTOM:4px;MARGIN:20px 0px 10px;OVERFLOW:auto;BORDER-LEFT:gray 1px solid;WIDTH:97.5%;CURSOR:text;MAX-HEIGHT:200px;LINE-HEIGHT:12pt;PADDING-TOP:4px;BORDER-BOTTOM:gray 1px solid;FONT-FAMILY:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;BACKGROUND-COLOR:#f4f4f4;"&gt;
&lt;div style="PADDING-RIGHT:0px;PADDING-LEFT:0px;FONT-SIZE:8pt;PADDING-BOTTOM:0px;OVERFLOW:visible;WIDTH:100%;COLOR:black;BORDER-TOP-STYLE:none;LINE-HEIGHT:12pt;PADDING-TOP:0px;FONT-FAMILY:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;BORDER-RIGHT-STYLE:none;BORDER-LEFT-STYLE:none;BACKGROUND-COLOR:#f4f4f4;BORDER-BOTTOM-STYLE:none;"&gt;&lt;pre style="PADDING-RIGHT:0px;PADDING-LEFT:0px;FONT-SIZE:8pt;PADDING-BOTTOM:0px;MARGIN:0em;OVERFLOW:visible;WIDTH:100%;COLOR:black;BORDER-TOP-STYLE:none;LINE-HEIGHT:12pt;PADDING-TOP:0px;FONT-FAMILY:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;BORDER-RIGHT-STYLE:none;BORDER-LEFT-STYLE:none;BACKGROUND-COLOR:white;BORDER-BOTTOM-STYLE:none;"&gt;&lt;span style="COLOR:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR:#800000;"&gt;dynamicData&lt;/span&gt; &lt;span style="COLOR:#ff0000;"&gt;dataContextType&lt;/span&gt;&lt;span style="COLOR:#0000ff;"&gt;=&amp;quot;Northwind.RAD.DynamicData.App_Code.NorthwindDataContext&amp;quot;&lt;/span&gt; &lt;/pre&gt;&lt;pre style="PADDING-RIGHT:0px;PADDING-LEFT:0px;FONT-SIZE:8pt;PADDING-BOTTOM:0px;MARGIN:0em;OVERFLOW:visible;WIDTH:100%;COLOR:black;BORDER-TOP-STYLE:none;LINE-HEIGHT:12pt;PADDING-TOP:0px;FONT-FAMILY:consolas, &amp;#39;Courier New&amp;#39;, courier, monospace;BORDER-RIGHT-STYLE:none;BORDER-LEFT-STYLE:none;BACKGROUND-COLOR:#f4f4f4;BORDER-BOTTOM-STYLE:none;"&gt;    &lt;span style="COLOR:#ff0000;"&gt;enableTemplates&lt;/span&gt;&lt;span style="COLOR:#0000ff;"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt;&lt;span style="COLOR:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Por último sólo queda ver el resultado:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/blogs/lruiz/WindowsLiveWriter/DynamicDataWebApplicationsocomomontarrpi_D34A/Sin%20nombre4_2.jpg"&gt;&lt;img style="BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px;" height="484" alt="Sin nombre4" src="http://geeks.ms/blogs/lruiz/WindowsLiveWriter/DynamicDataWebApplicationsocomomontarrpi_D34A/Sin%20nombre4_thumb.jpg" width="356" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Las filas de la tabla:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/blogs/lruiz/WindowsLiveWriter/DynamicDataWebApplicationsocomomontarrpi_D34A/Sin%20nombre5_2.jpg"&gt;&lt;img style="BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px;" height="484" alt="Sin nombre5" src="http://geeks.ms/blogs/lruiz/WindowsLiveWriter/DynamicDataWebApplicationsocomomontarrpi_D34A/Sin%20nombre5_thumb.jpg" width="447" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Editando un registro:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://geeks.ms/blogs/lruiz/WindowsLiveWriter/DynamicDataWebApplicationsocomomontarrpi_D34A/Sin%20nombre6_2.jpg"&gt;&lt;img style="BORDER-RIGHT:0px;BORDER-TOP:0px;BORDER-LEFT:0px;BORDER-BOTTOM:0px;" height="166" alt="Sin nombre6" src="http://geeks.ms/blogs/lruiz/WindowsLiveWriter/DynamicDataWebApplicationsocomomontarrpi_D34A/Sin%20nombre6_thumb.jpg" width="644" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Como podéis ver se tarda excaso un minutillo en montarse una aplicación para mantener una base datos, que por supuesto, esto no es una aplicación empresarial ni mucho menos pero que viene muy bien para cosillas pequeñas de mantenimiento y tampoco se necesitan unos conocimientos experimentados.&lt;/p&gt;
&lt;p&gt;En la figura donde se muestran los datos de la tabla, llama la atención la marca amarilla sobre el strock. Eso se puede lograr creandonos nuestros propios Data fields, que en este caso resalta los productos que tienen un stock menor de 100 pero eso lo dejamos para el siguiente artículo.&lt;/p&gt;
&lt;p&gt;Y no quería despedirme sin antes comentar que hoy han actualizado ASP.NET Dynamic Data Preview:&lt;/p&gt;
&lt;p&gt;&lt;a title="http://code.msdn.microsoft.com/dynamicdata" href="http://code.msdn.microsoft.com/dynamicdata"&gt;http://code.msdn.microsoft.com/dynamicdata&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Salu2&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://geeks.ms/aggbug.aspx?PostID=82886" width="1" height="1"&gt;</description><category domain="http://geeks.ms/blogs/lruiz/archive/tags/Web/default.aspx">Web</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/Dynamic+Data/default.aspx">Dynamic Data</category><category domain="http://geeks.ms/blogs/lruiz/archive/tags/ASP.NET+3.5/default.aspx">ASP.NET 3.5</category></item></channel></rss>