Strict Standards: Declaration of UserSettings::get() should be compatible with AbstractSettings::get($col_key1, $col_key2 = NULL, $col_key3 = NULL) in /home/soucafe/soucafecomleite.com.br/blogs/inc/users/model/_usersettings.class.php on line 0

Strict Standards: Declaration of UserSettings::set() should be compatible with AbstractSettings::set() in /home/soucafe/soucafecomleite.com.br/blogs/inc/users/model/_usersettings.class.php on line 0

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 223

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 304

Warning: Cannot modify header information - headers already sent by (output started at /home/soucafe/soucafecomleite.com.br/blogs/inc/users/model/_usersettings.class.php:0) in /home/soucafe/soucafecomleite.com.br/blogs/inc/sessions/model/_session.class.php on line 219

Strict Standards: Declaration of Blog::set() should be compatible with DataObject::set($parname, $parvalue, $make_null = false) in /home/soucafe/soucafecomleite.com.br/blogs/inc/collections/model/_blog.class.php on line 0

Strict Standards: Declaration of Group::set() should be compatible with DataObject::set($parname, $parvalue, $make_null = false) in /home/soucafe/soucafecomleite.com.br/blogs/inc/users/model/_group.class.php on line 0

Strict Standards: Declaration of User::dbdelete() should be compatible with DataObject::dbdelete() in /home/soucafe/soucafecomleite.com.br/blogs/inc/users/model/_user.class.php on line 0

Strict Standards: Declaration of User::set() should be compatible with DataObject::set($parname, $parvalue, $make_null = false) in /home/soucafe/soucafecomleite.com.br/blogs/inc/users/model/_user.class.php on line 0

Strict Standards: Declaration of Filetype::set() should be compatible with DataObject::set($parname, $parvalue, $make_null = false) in /home/soucafe/soucafecomleite.com.br/blogs/inc/files/model/_filetype.class.php on line 0

Strict Standards: Declaration of Comment::set() should be compatible with DataObject::set($parname, $parvalue, $make_null = false) in /home/soucafe/soucafecomleite.com.br/blogs/inc/comments/model/_comment.class.php on line 0

Strict Standards: Declaration of ItemListLight::query() should be compatible with Results::query($create_default_cols_if_needed = true, $append_limit = true, $append_order_by = true, $query_title = 'Results::Q...') in /home/soucafe/soucafecomleite.com.br/blogs/inc/items/model/_itemlistlight.class.php on line 48

Strict Standards: Declaration of CollectionSettings::_load() should be compatible with AbstractSettings::_load($arg1 = NULL, $arg2 = NULL, $arg3 = NULL) in /home/soucafe/soucafecomleite.com.br/blogs/inc/collections/model/_collsettings.class.php on line 0

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Warning: Creating default object from empty value in /home/soucafe/soucafecomleite.com.br/blogs/inc/settings/model/_abstractsettings.class.php on line 236

Notice: Array to string conversion in /home/soucafe/soucafecomleite.com.br/blogs/inc/_core/_param.funcs.php on line 1161

Notice: Array to string conversion in /home/soucafe/soucafecomleite.com.br/blogs/inc/_core/_param.funcs.php on line 1161

Warning: Cannot modify header information - headers already sent by (output started at /home/soucafe/soucafecomleite.com.br/blogs/inc/users/model/_usersettings.class.php:0) in /home/soucafe/soucafecomleite.com.br/blogs/inc/skins/_skin.funcs.php on line 379
namespace Programatik http://programatik.soucafecomleite.com.br/ pt-BR http://blogs.law.harvard.edu/tech/rss 60
Strict Standards: Declaration of GenericCategoryCache::clear() should be compatible with DataObjectCache::clear($keep_shadow = false) in /home/soucafe/soucafecomleite.com.br/blogs/inc/generic/model/_genericcategorycache.class.php on line 0

Strict Standards: Declaration of GenericCategory::set() should be compatible with DataObject::set($parname, $parvalue, $make_null = false) in /home/soucafe/soucafecomleite.com.br/blogs/inc/generic/model/_genericcategory.class.php on line 0
jQuery: live(); http://programatik.soucafecomleite.com.br/jquery-live Tue, 05 May 2009 12:03:42 +0000 mrxrsd javascript jquery 77@http://www.soucafecomleite.com.br/blogs/
Strict Standards: Declaration of smilies_plugin::GetDefaultSettings() should be compatible with Plugin::GetDefaultSettings(&$params) in /home/soucafe/soucafecomleite.com.br/blogs/plugins/_smilies.plugin.php on line 0

Strict Standards: Declaration of smilies_plugin::GetDefaultUserSettings() should be compatible with Plugin::GetDefaultUserSettings(&$params) in /home/soucafe/soucafecomleite.com.br/blogs/plugins/_smilies.plugin.php on line 0

Deprecated: Assigning the return value of new by reference is deprecated in /home/soucafe/soucafecomleite.com.br/blogs/plugins/code_highlight_plugin/_code_highlight.plugin.php on line 344

Strict Standards: Declaration of code_highlight_plugin::AdminEndHtmlHead() should be compatible with Plugin::AdminEndHtmlHead(&$params) in /home/soucafe/soucafecomleite.com.br/blogs/plugins/code_highlight_plugin/_code_highlight.plugin.php on line 0

Strict Standards: Declaration of code_highlight_plugin::SkinBeginHtmlHead() should be compatible with Plugin::SkinBeginHtmlHead(&$params) in /home/soucafe/soucafecomleite.com.br/blogs/plugins/code_highlight_plugin/_code_highlight.plugin.php on line 0

Strict Standards: Declaration of auto_p_plugin::GetDefaultSettings() should be compatible with Plugin::GetDefaultSettings(&$params) in /home/soucafe/soucafecomleite.com.br/blogs/plugins/_auto_p.plugin.php on line 0
<p>Um dos problemas que enfrentamos quando usamos Ajax e jQuery &#233; o momento que devemos realizar o binding do eventos. Uma das maneiras &#233; colocar o c&#243;digo para ser executado a cada postback.</p> <a href="http://programatik.soucafecomleite.com.br/jquery-live#more77">Leia mais &raquo;</a><div class="item_footer"><p><small>Grupo: <a href="http://www.soucafecomleite.com.br/">Sou Caf&#234; Com Leite</a>.</small></p></div>
Um dos problemas que enfrentamos quando usamos Ajax e jQuery é o momento que devemos realizar o binding do eventos. Uma das maneiras é colocar o código para ser executado a cada postback.

Leia mais »]]>
http://programatik.soucafecomleite.com.br/jquery-live#comments
C#: Persistindo o ViewState http://programatik.soucafecomleite.com.br/persistindo-view-state Tue, 31 Mar 2009 12:32:00 +0000 mrxrsd dotnet c# 76@http://www.soucafecomleite.com.br/blogs/ <p>N&#227;o irei entrar no m&#233;rito sobre o que &#233; o viewstate, mas dependendo do n&#250;mero de webcontrols que temos em nossa p&#225;gina ele se torna absurdamente grande, uma maneira de contornar isso &#233; salvando ele na sessao.</p> <p>Iremos criar um atributo no webconfig, caso ele esteja ativado ele salvar&#225; o viewstate na sess&#227;o.</p> <p class="amcode">C#:</p><div class="codeblock amc_csharp amc_long"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #FF0000;">object</span> LoadPageStateFromPersistenceMedium<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">object</span> objViewState;<br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>ConfigurationManager.<span style="color: #0000FF;">AppSettings</span><span style="color: #000000;">&#91;</span><span style="color: #808080;">&quot;ServerSideViewState&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF;">null</span> <span style="color: #008000;">&amp;&amp;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc7"></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ConfigurationManager.<span style="color: #0000FF;">AppSettings</span><span style="color: #000000;">&#91;</span><span style="color: #808080;">&quot;ServerSideViewState&quot;</span><span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">ToUpper</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Equals</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;TRUE&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc8"></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc9"></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; objViewState <span style="color: #008000;">=</span> Context.<span style="color: #0000FF;">Session</span><span style="color: #000000;">&#91;</span><span style="color: #808080;">&quot;VIEWSTATE&quot;</span><span style="color: #000000;">&#93;</span>;<br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc0"><div class="amc1"></div></div></td><td><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"><div class="amc1"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>objViewState <span style="color: #008000;">==</span> <span style="color: #0600FF;">null</span><span style="color: #000000;">&#41;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"><div class="amc1"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"><div class="amc1"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #0600FF;">return</span>;<br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"><div class="amc1"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Sessao expirada</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"><div class="amc1"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"><div class="amc1"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc7"><div class="amc1"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">return</span> objViewState; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc8"><div class="amc1"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc9"><div class="amc1"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc0"><div class="amc2"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">else</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"><div class="amc2"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"><div class="amc2"></div></div></td><td><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"><div class="amc2"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">return</span> <span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">LoadPageStateFromPersistenceMedium</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;<br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"><div class="amc2"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"><div class="amc2"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"><div class="amc2"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc7"><div class="amc2"></div></div></td><td><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc8"><div class="amc2"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">protected</span> <span style="color: #0600FF;">override</span> <span style="color: #0600FF;">void</span> SavePageStateToPersistenceMedium<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> state<span style="color: #000000;">&#41;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc9"><div class="amc2"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc0"><div class="amc3"></div></div></td><td><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"><div class="amc3"></div></div></td><td><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"><div class="amc3"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>ConfigurationManager.<span style="color: #0000FF;">AppSettings</span><span style="color: #000000;">&#91;</span><span style="color: #808080;">&quot;ServerSideViewState&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">!=</span> <span style="color: #0600FF;">null</span> <span style="color: #008000;">&amp;&amp;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"><div class="amc3"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ConfigurationManager.<span style="color: #0000FF;">AppSettings</span><span style="color: #000000;">&#91;</span><span style="color: #808080;">&quot;ServerSideViewState&quot;</span><span style="color: #000000;">&#93;</span>.<span style="color: #0000FF;">ToUpper</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>.<span style="color: #0000FF;">Equals</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;TRUE&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"><div class="amc3"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"><div class="amc3"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Context.<span style="color: #0000FF;">Session</span><span style="color: #000000;">&#91;</span><span style="color: #808080;">&quot;VIEWSTATE&quot;</span><span style="color: #000000;">&#93;</span> <span style="color: #008000;">=</span> state;<br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"><div class="amc3"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc7"><div class="amc3"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">else</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc8"><div class="amc3"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc9"><div class="amc3"></div></div></td><td><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc0"><div class="amc4"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">base</span>.<span style="color: #0000FF;">SavePageStateToPersistenceMedium</span><span style="color: #000000;">&#40;</span>state<span style="color: #000000;">&#41;</span>;<br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"><div class="amc4"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"><div class="amc4"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"><div class="amc4"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span></td></tr></table></div><div class="item_footer"><p><small>Grupo: <a href="http://www.soucafecomleite.com.br/">Sou Caf&#234; Com Leite</a>.</small></p></div> Não irei entrar no mérito sobre o que é o viewstate, mas dependendo do número de webcontrols que temos em nossa página ele se torna absurdamente grande, uma maneira de contornar isso é salvando ele na sessao.

Iremos criar um atributo no webconfig, caso ele esteja ativado ele salvará o viewstate na sessão.

C#:

protected override object LoadPageStateFromPersistenceMedium()
        {

            object objViewState;

            if (ConfigurationManager.AppSettings["ServerSideViewState"] != null &&
                ConfigurationManager.AppSettings["ServerSideViewState"].ToUpper().Equals("TRUE"))
            {
                objViewState = Context.Session["VIEWSTATE"];

                if (objViewState == null)
                {
                     return;
                    // Sessao expirada
                }
                               
                return objViewState;                
               
            }
            else
            {

                return base.LoadPageStateFromPersistenceMedium();
            }
                             
        }

        protected override void SavePageStateToPersistenceMedium(object state)
        {


            if (ConfigurationManager.AppSettings["ServerSideViewState"] != null &&
                ConfigurationManager.AppSettings["ServerSideViewState"].ToUpper().Equals("TRUE"))
            {
                Context.Session["VIEWSTATE"] = state;
            }
            else
            {

                base.SavePageStateToPersistenceMedium(state);
            }
                       
        }
]]>
http://programatik.soucafecomleite.com.br/persistindo-view-state#comments
News: Internet Explorer 8.0 e Silverlight 3 http://programatik.soucafecomleite.com.br/news-ie8-silverlight3 Fri, 20 Mar 2009 11:52:12 +0000 mrxrsd news 75@http://www.soucafecomleite.com.br/blogs/ <p>Foi lan&#231;ado oficialmente a vers&#227;o final do Internet Explorer 8.0, assim como a Microsoft tamb&#233;m disponibilizou a vers&#227;o 3 do Silverlight.</p> <p><strong>Internet Explorer:</strong><br /> <a href="http://www.microsoft.com/windows/internet-explorer/default.aspx">http://www.microsoft.com/windows/internet-explorer/default.aspx</a></p> <p><strong>Silverlight</strong></p> <p>Runtime:<br /> <a href="http://go.microsoft.com/fwlink/?linkid=143433">http://go.microsoft.com/fwlink/?linkid=143433</a></p> <p>Silverlight 3 Tools for Visual Studio 2008 SP1:<br /> <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=11dc7151-dbd6-4e39-878f-5081863cbb5d">http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=11dc7151-dbd6-4e39-878f-5081863cbb5d</a></p> <p>SDK:<br /> <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=d09b6ecf-9a45-4d99-b752-2a330a937bc4!">http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=d09b6ecf-9a45-4d99-b752-2a330a937bc4!</a></p> <p>Documentation:<br /> <a href="http://msdn.microsoft.com/en-us/library/cc838158(vs.96).aspx">http://msdn.microsoft.com/en-us/library/cc838158(vs.96).aspx</a>.</p> <p>Blend 3 Preview:<br /> <a href="http://www.microsoft.com/expression/blendpreview">http://www.microsoft.com/expression/blendpreview</a></p><div class="item_footer"><p><small>Grupo: <a href="http://www.soucafecomleite.com.br/">Sou Caf&#234; Com Leite</a>.</small></p></div> Foi lançado oficialmente a versão final do Internet Explorer 8.0, assim como a Microsoft também disponibilizou a versão 3 do Silverlight.

Internet Explorer:
http://www.microsoft.com/windows/internet-explorer/default.aspx

Silverlight

Runtime:
http://go.microsoft.com/fwlink/?linkid=143433

Silverlight 3 Tools for Visual Studio 2008 SP1:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=11dc7151-dbd6-4e39-878f-5081863cbb5d

SDK:
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=d09b6ecf-9a45-4d99-b752-2a330a937bc4!

Documentation:
http://msdn.microsoft.com/en-us/library/cc838158(vs.96).aspx.

Blend 3 Preview:
http://www.microsoft.com/expression/blendpreview

]]>
http://programatik.soucafecomleite.com.br/news-ie8-silverlight3#comments
Ebook Tutorial Asp.net MVC http://programatik.soucafecomleite.com.br/free-aspnet-mvc-ebook Wed, 11 Mar 2009 11:15:23 +0000 mrxrsd dotnet 74@http://www.soucafecomleite.com.br/blogs/ <p>ScottGu e outras autoridades do asp.net est&#227;o lan&#231;ado um livro pela Wrox e uns dos cap&#237;tulos do livros que mostra um exemplo de uma aplica&#231;&#227;o est&#225; sendo disponibilizado em forma de PDF. Confira o post do ScottGu.</p> <p>Link: <a target="_blank" href="http://weblogs.asp.net/scottgu/archive/2009/03/10/free-asp-net-mvc-ebook-tutorial.aspx">http://weblogs.asp.net/scottgu/archive/2009/03/10/free-asp-net-mvc-ebook-tutorial.aspx</a></p><div class="item_footer"><p><small>Grupo: <a href="http://www.soucafecomleite.com.br/">Sou Caf&#234; Com Leite</a>.</small></p></div> ScottGu e outras autoridades do asp.net estão lançado um livro pela Wrox e uns dos capítulos do livros que mostra um exemplo de uma aplicação está sendo disponibilizado em forma de PDF. Confira o post do ScottGu.

Link: http://weblogs.asp.net/scottgu/archive/2009/03/10/free-asp-net-mvc-ebook-tutorial.aspx

]]>
http://programatik.soucafecomleite.com.br/free-aspnet-mvc-ebook#comments
C#: Setando texto para um enum http://programatik.soucafecomleite.com.br/enum-com-texto Mon, 02 Mar 2009 12:17:00 +0000 mrxrsd dotnet c# 73@http://www.soucafecomleite.com.br/blogs/ <p>Acredito que quase todo mundo j&#225; precisou fazer uma valida&#231;&#227;o de dom&#237;nio alguma vez e boa parte das vezes, a primeira id&#233;ia que vem &#233; utilizar um enum, por&#233;m algumas pessoas esbarram em uma dificuldade que &#233; n&#227;o poder ter um "enum de strings", ou seja, setar um texto decente para exibi&#231;&#227;o.</p> <a href="http://programatik.soucafecomleite.com.br/enum-com-texto#more73">Leia mais &raquo;</a><div class="item_footer"><p><small>Grupo: <a href="http://www.soucafecomleite.com.br/">Sou Caf&#234; Com Leite</a>.</small></p></div> Acredito que quase todo mundo já precisou fazer uma validação de domínio alguma vez e boa parte das vezes, a primeira idéia que vem é utilizar um enum, porém algumas pessoas esbarram em uma dificuldade que é não poder ter um "enum de strings", ou seja, setar um texto decente para exibição.

Leia mais »]]>
http://programatik.soucafecomleite.com.br/enum-com-texto#comments
Dica: Conversor C# -> VB .NET / VB .NET -> C# http://programatik.soucafecomleite.com.br/conversor-csharp-vb Fri, 13 Feb 2009 11:09:41 +0000 mrxrsd dicas 72@http://www.soucafecomleite.com.br/blogs/ <p>Pra quem deseja converter c&#243;digos em c# para vb.net ou vice-versa, segue abaixo um link de um convertor online.</p> <p><a href="http://www.developerfusion.com/tools/convert/csharp-to-vb/">http://www.developerfusion.com/tools/convert/csharp-to-vb/</a></p><div class="item_footer"><p><small>Grupo: <a href="http://www.soucafecomleite.com.br/">Sou Caf&#234; Com Leite</a>.</small></p></div> Pra quem deseja converter códigos em c# para vb.net ou vice-versa, segue abaixo um link de um convertor online.

http://www.developerfusion.com/tools/convert/csharp-to-vb/

]]>
http://programatik.soucafecomleite.com.br/conversor-csharp-vb#comments
VsDocs jQuery 1.3.1 http://programatik.soucafecomleite.com.br/vsdocs-131-jquery Mon, 09 Feb 2009 10:45:48 +0000 mrxrsd javascript jquery 71@http://www.soucafecomleite.com.br/blogs/ <p>O VsDocs, que permite o uso de intellisense no Visual Studio, do jQuery 1.3.1 acaba de ser atualizado no site, atualizem as suas IDE.</p> <p>Link para Download: <a href="http://docs.jquery.com/Downloading_jQuery#Download_jQuery" target="_blank">aqui</a></p> <p>Edit:</p> <p>Pra quem n&#227;o sabe como habilitar o intellisense do jQuery no Visual Studio, visite o blog do <a href="http://fpimentel88.wordpress.com/2009/02/07/jquery-13-intellisense-no-visual-studio-2008/" target="_blank">felipe pimentel</a>.</p><div class="item_footer"><p><small>Grupo: <a href="http://www.soucafecomleite.com.br/">Sou Caf&#234; Com Leite</a>.</small></p></div> O VsDocs, que permite o uso de intellisense no Visual Studio, do jQuery 1.3.1 acaba de ser atualizado no site, atualizem as suas IDE.

Link para Download: aqui

Edit:

Pra quem não sabe como habilitar o intellisense do jQuery no Visual Studio, visite o blog do felipe pimentel.

]]>
http://programatik.soucafecomleite.com.br/vsdocs-131-jquery#comments
Action Delegate http://programatik.soucafecomleite.com.br/action-delagate Tue, 03 Feb 2009 10:41:22 +0000 mrxrsd dotnet c# 70@http://www.soucafecomleite.com.br/blogs/ <p>Action Delegate</p> <p>Os Action delegate encapsulam m&#233;todos que n&#227;o possuem nenhum retorno e aceitam zero ou at&#233; quatro param&#234;tros. A sua assinatura &#233; encontrada no System namespace.</p> <p class="amcode">C#:</p><div class="codeblock amc_csharp amc_long"><table><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"></div></td><td><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>;<br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"></div></td><td><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Collections</span>.<span style="color: #0000FF;">Generic</span>;<br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"></div></td><td><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Linq</span>;<br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"></div></td><td><span style="color: #0600FF;">using</span> <span style="color: #000000;">System</span>.<span style="color: #0000FF;">Text</span>;<br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"></div></td><td><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"></div></td><td><span style="color: #0600FF;">namespace</span> ConsoleApplication1<br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc7"></div></td><td><span style="color: #000000;">&#123;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc8"></div></td><td>&nbsp; &nbsp; <span style="color: #FF0000;">class</span> Program<br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc9"></div></td><td>&nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc0"><div class="amc1"></div></div></td><td><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"><div class="amc1"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">class</span> Pessoa<br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"><div class="amc1"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"><div class="amc1"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">private</span> <span style="color: #FF0000;">string</span> _nome;<br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"><div class="amc1"></div></div></td><td><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"><div class="amc1"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">string</span> nome<br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"><div class="amc1"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc7"><div class="amc1"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">return</span> _nome; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc8"><div class="amc1"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set <span style="color: #000000;">&#123;</span> _nome <span style="color: #008000;">=</span> value; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc9"><div class="amc1"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc0"><div class="amc2"></div></div></td><td><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"><div class="amc2"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">private</span> <span style="color: #FF0000;">int</span> _idade;<br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"><div class="amc2"></div></div></td><td><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"><div class="amc2"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">int</span> idade<br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"><div class="amc2"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"><div class="amc2"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">return</span> _idade; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"><div class="amc2"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set <span style="color: #000000;">&#123;</span> _idade <span style="color: #008000;">=</span> value; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc7"><div class="amc2"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc8"><div class="amc2"></div></div></td><td><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc9"><div class="amc2"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #FF0000;">bool</span> _marcado;<br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc0"><div class="amc3"></div></div></td><td><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"><div class="amc3"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #FF0000;">bool</span> marcado<br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"><div class="amc3"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"><div class="amc3"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get <span style="color: #000000;">&#123;</span> <span style="color: #0600FF;">return</span> _marcado; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"><div class="amc3"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; set <span style="color: #000000;">&#123;</span> _marcado <span style="color: #008000;">=</span> value; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"><div class="amc3"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"><div class="amc3"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc7"><div class="amc3"></div></div></td><td><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc8"><div class="amc3"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> Main<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">string</span><span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span> args<span style="color: #000000;">&#41;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc9"><div class="amc3"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc0"><div class="amc4"></div></div></td><td><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"><div class="amc4"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Declarando um simples delegate</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"><div class="amc4"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Action<span style="color: #008000;">&lt;</span>Pessoa<span style="color: #008000;">&gt;</span> action <span style="color: #008000;">=</span> EscrevaNome;<br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"><div class="amc4"></div></div></td><td><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"><div class="amc4"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Criando nossa lista de pessoas</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"><div class="amc4"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; List<span style="color: #008000;">&lt;</span>Pessoa<span style="color: #008000;">&gt;</span> vetPessoa <span style="color: #008000;">=</span> <a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> List<span style="color: #008000;">&lt;</span>Pessoa<span style="color: #008000;">&gt;</span><span style="color: #000000;">&#123;</span> <br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"><div class="amc4"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Pessoa<span style="color: #000000;">&#123;</span> nome<span style="color: #008000;">=</span><span style="color: #808080;">&quot;Pessoa 1&quot;</span>, idade<span style="color: #008000;">=</span><span style="color: #FF0000;">15</span><span style="color: #000000;">&#125;</span>, <br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc7"><div class="amc4"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Pessoa<span style="color: #000000;">&#123;</span> nome<span style="color: #008000;">=</span><span style="color: #808080;">&quot;Pessoa 2&quot;</span>, idade<span style="color: #008000;">=</span><span style="color: #FF0000;">18</span><span style="color: #000000;">&#125;</span>,<br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc8"><div class="amc4"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Pessoa<span style="color: #000000;">&#123;</span> nome<span style="color: #008000;">=</span><span style="color: #808080;">&quot;Pessoa 3&quot;</span>, idade<span style="color: #008000;">=</span><span style="color: #FF0000;">24</span><span style="color: #000000;">&#125;</span>,<br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc9"><div class="amc4"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Pessoa<span style="color: #000000;">&#123;</span> nome<span style="color: #008000;">=</span><span style="color: #808080;">&quot;Pessoa 4&quot;</span>, idade<span style="color: #008000;">=</span><span style="color: #FF0000;">10</span><span style="color: #000000;">&#125;</span>,<br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc0"><div class="amc5"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<a href="http://www.google.com/search?q=new+msdn.microsoft.com"><span style="color: #008000;">new</span></a> Pessoa<span style="color: #000000;">&#123;</span> nome<span style="color: #008000;">=</span><span style="color: #808080;">&quot;Pessoa 5&quot;</span>, idade<span style="color: #008000;">=</span><span style="color: #FF0000;">13</span><span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"><div class="amc5"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #000000;">&#125;</span>;<br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"><div class="amc5"></div></div></td><td><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"><div class="amc5"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Chamando nosso delegate</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"><div class="amc5"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vetPessoa.<span style="color: #0600FF;">ForEach</span><span style="color: #000000;">&#40;</span>action<span style="color: #000000;">&#41;</span>;<br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"><div class="amc5"></div></div></td><td><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"><div class="amc5"></div></div></td><td><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc7"><div class="amc5"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Vamos supor que gostariamos marcar todas as pessoas que tem mais de 15 anos</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc8"><div class="amc5"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; vetPessoa.<span style="color: #0000FF;">FindAll</span><span style="color: #000000;">&#40;</span>p <span style="color: #008000;">=&gt;</span> p.<span style="color: #0000FF;">idade</span> <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">15</span><span style="color: #000000;">&#41;</span>.<span style="color: #0600FF;">ForEach</span><span style="color: #000000;">&#40;</span>p <span style="color: #008000;">=&gt;</span> p.<span style="color: #0000FF;">marcado</span> <span style="color: #008000;">=</span> <span style="color: #0600FF;">true</span><span style="color: #000000;">&#41;</span>;<br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc9"><div class="amc5"></div></div></td><td><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc0"><div class="amc6"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// Primeiro utilizamos o m&#233;todo FindAll que aceita um Predicate para fazer o filtro</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"><div class="amc6"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #008080; font-style: italic;">// e depois, usamos o ForEach que aceita uma action para realizar o trabalho</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"><div class="amc6"></div></div></td><td><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"><div class="amc6"></div></div></td><td><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc4"><div class="amc6"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc5"><div class="amc6"></div></div></td><td><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc6"><div class="amc6"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0600FF;">public</span> <span style="color: #0600FF;">static</span> <span style="color: #0600FF;">void</span> EscrevaNome<span style="color: #000000;">&#40;</span>Pessoa p<span style="color: #000000;">&#41;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc7"><div class="amc6"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#123;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc8"><div class="amc6"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Console.<span style="color: #0000FF;">WriteLine</span><span style="color: #000000;">&#40;</span>p.<span style="color: #0000FF;">nome</span><span style="color: #000000;">&#41;</span>;<br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc9"><div class="amc6"></div></div></td><td>&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc0"><div class="amc7"></div></div></td><td>&nbsp; &nbsp; <span style="color: #000000;">&#125;</span><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc1"><div class="amc7"></div></div></td><td><br /></td></tr><tr class="amc_code_even"><td class="amc_line"><div class="amc2"><div class="amc7"></div></div></td><td><br /></td></tr><tr class="amc_code_odd"><td class="amc_line"><div class="amc3"><div class="amc7"></div></div></td><td><span style="color: #000000;">&#125;</span></td></tr></table></div><div class="item_footer"><p><small>Grupo: <a href="http://www.soucafecomleite.com.br/">Sou Caf&#234; Com Leite</a>.</small></p></div> Action Delegate

Os Action delegate encapsulam métodos que não possuem nenhum retorno e aceitam zero ou até quatro paramêtros. A sua assinatura é encontrada no System namespace.

C#:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {

        public class Pessoa
        {
            private string _nome;

            public string nome
            {
                get { return _nome; }
                set { _nome = value; }
            }

            private int _idade;

            public int idade
            {
                get { return _idade; }
                set { _idade = value; }
            }

            bool _marcado;

            public bool marcado
            {
                get { return _marcado; }
                set { _marcado = value; }
            }
        }

        static void Main(string[] args)
        {

            // Declarando um simples delegate
            Action<Pessoa> action = EscrevaNome;

            // Criando nossa lista de pessoas
            List<Pessoa> vetPessoa = new List<Pessoa>{
                                               new Pessoa{ nome="Pessoa 1", idade=15},
                                               new Pessoa{ nome="Pessoa 2", idade=18},
                                               new Pessoa{ nome="Pessoa 3", idade=24},
                                               new Pessoa{ nome="Pessoa 4", idade=10},
                                               new Pessoa{ nome="Pessoa 5", idade=13}
                                             };

            // Chamando nosso delegate
            vetPessoa.ForEach(action);


            // Vamos supor que gostariamos marcar todas as pessoas que tem mais de 15 anos
            vetPessoa.FindAll(p => p.idade > 15).ForEach(p => p.marcado = true);

            // Primeiro utilizamos o método FindAll que aceita um Predicate para fazer o filtro
            // e depois, usamos o ForEach que aceita uma action para realizar o trabalho


        }

        public static void EscrevaNome(Pessoa p)
        {
            Console.WriteLine(p.nome);
        }
    }


}
]]>
http://programatik.soucafecomleite.com.br/action-delagate#comments

Deprecated: Non-static method Hitlist::dbprune() should not be called statically, assuming $this from incompatible context in /home/soucafe/soucafecomleite.com.br/blogs/inc/sessions/model/_hit.class.php on line 531