<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1796403205044129225</id><updated>2012-01-29T15:43:06.047-08:00</updated><category term='C# Web Application Project'/><category term='SQL'/><category term='C# CalendarExtender'/><category term='concatenate columns'/><category term='C# Delegate'/><category term='C# email'/><category term='gwt'/><category term='C# SelectedIndexChanged'/><category term='C# documentation'/><category term='DataTable'/><category term='C# Configuration Mananger'/><category term='FindControl'/><category term='C# Casting'/><category term='Group Policy'/><category term='Administration'/><category term='C# HTML'/><category term='C# CollapsiblePanelExtender'/><category term='C# Profile'/><category term='C# ADO paging'/><category term='C# statements'/><category term='C# javascript'/><category term='C# Google Charts'/><category term='.NET 3.5'/><category term='C# Interface'/><category term='VB random'/><category term='Windows Vista'/><category term='C# RadioButtonList'/><category term='C# log4net'/><category term='CSS'/><category term='C# Trigger'/><category term='C# Find Control'/><category term='C# random'/><category term='C# regex'/><category term='C# XML XPath'/><category term='C# YahooMail webservice'/><category term='HTML preview'/><category term='C# DropDownList'/><category term='C# ConnectionString'/><category term='C# Multiple PostBack'/><category term='FlexWiki'/><category term='C# regex css'/><category term='html'/><category term='leading 0s'/><category term='C# Inheritance'/><category term='C# AutoComplete'/><category term='C# Membership'/><category term='C# Mail'/><category term='C# Control Tree'/><category term='C# GUID'/><category term='DokuWiki'/><category term='subversion'/><category term='Excel'/><category term='C# LoginStatus'/><category term='C# Sleep'/><category term='C# caching'/><category term='Vista'/><category term='wiki'/><category term='Template'/><category term='CA Anti-Virus'/><category term='css ADO'/><category term='C# global access'/><category term='C# default'/><category term='email preview'/><category term='C# HyperLink'/><category term='C# sitemap'/><category term='graph'/><category term='C# reset form'/><category term='C# Web User Control'/><category term='Pageable'/><category term='C# Error'/><category term='C# config'/><category term='C# DataBinding'/><category term='DataSet'/><category term='C# MasterPage'/><category term='C# Wait'/><category term='DataPageable'/><category term='C# Values'/><category term='C# properties'/><category term='C# focus'/><category term='C# SQL Server'/><category term='C# System.Threading'/><category term='C# ADO'/><category term='SQL Server Management Studio Express'/><category term='C# File I/O'/><category term='lazy load panel'/><category term='C# SQL'/><category term='SQL Update'/><category term='C# Dynamic Control'/><category term='software design'/><category term='statements'/><category term='Java'/><category term='C# DateTime'/><category term='C# GridView'/><category term='C#'/><category term='C# bool'/><category term='naming conventions'/><category term='C# securitytrimming'/><category term='SQL Delete'/><category term='C# sorting'/><category term='C# Trace'/><category term='Internet Explorer 8'/><category term='C# CustomControl'/><category term='C# StringBuilder'/><category term='C# const'/><category term='Automatic Updates'/><category term='environmental variable'/><category term='Microsoft Charts'/><category term='C# TabContainer'/><category term='C# AJAX'/><category term='C# Session'/><category term='C# String'/><category term='SVN'/><category term='C# static'/><category term='INamingContainer'/><category term='C# Stored Procedure'/><category term='C# ConnectionStringSettings'/><title type='text'>Programming Journal C#, Java, SQL</title><subtitle type='html'>Programming Journal C#, Java, SQL and to a lesser extent HTML, CSS, XML, and regex. I made this so other programmers could benefit from my experience.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://techron.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default?start-index=101&amp;max-results=100'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>112</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-3052061682998497432</id><published>2009-08-25T18:02:00.000-07:00</published><updated>2009-08-25T23:24:03.315-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# Web Application Project'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Profile'/><title type='text'>Installing Web Profile Generator on ASP.NET 3.5</title><content type='html'>I finally figure out how to do this. Unfortunately the technical writers were out to lunch when the tried to explain this. Here is my explanation on how to accomplish this in ASP.NET 3.5:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://weblogs.asp.net/joewrobel/archive/2008/02/03/web-profile-builder-for-web-application-projects.aspx "&gt;http://weblogs.asp.net/joewrobel/archive/2008/02/03/web-profile-builder-for-web-application-projects.aspx &lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Install the MSI. &lt;br /&gt;Add (under the other Imports), the &amp;lt;Import Project="$(MSBuildExtensionsPath)\WebProfileBuilder\WebProfileBuilder.targets" /&amp;gt;](without []) line to the "MyProject.csproj" file (NOT the user project file, but the one without an extension on Vista) where MyProject is your Web Application Project name. &lt;br /&gt;Add an App_Code folder to your project. &lt;br /&gt;Add the WebProfile.cs file (rt. clicking folder and add existing item) &lt;br /&gt;Rt. click the WebProfile.cs file and click properties. &lt;br /&gt;Change its Build Action from Content to Compile. &lt;br /&gt;&lt;br /&gt;Add the profile tags to the web.config file: e.g. &lt;br /&gt;&lt;br /&gt;Now you are set. Just make a call to your Profile by setting up this method:        &lt;br /&gt;&lt;br /&gt;public static WebProfile Profile&lt;br /&gt;        {&lt;br /&gt;            //get { return new WebProfile(HttpContext.Current.Profile); }&lt;br /&gt;            get { return WebProfile.Current; }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;It should be noted that when you change the Profile, you will need to remove the class from the App_Code and add the newly generated WebProfile.cs class as before.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-3052061682998497432?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/3052061682998497432/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=3052061682998497432' title='63 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3052061682998497432'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3052061682998497432'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2009/08/installing-web-profile-generator-on.html' title='Installing Web Profile Generator on ASP.NET 3.5'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>63</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-4661950193314918698</id><published>2009-08-23T09:26:00.000-07:00</published><updated>2009-08-23T09:56:59.682-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Windows Vista'/><category scheme='http://www.blogger.com/atom/ns#' term='Automatic Updates'/><category scheme='http://www.blogger.com/atom/ns#' term='Internet Explorer 8'/><title type='text'>How to disable Internet Explorer 8 From Installing With Automatic Updates</title><content type='html'>To disable Internet Explorer 8 From Installing With Automatic Updates follow these directions:&lt;br /&gt;Download the file from the link below and run.&lt;br /&gt;&lt;br /&gt;References: &lt;ul&gt;&lt;li&gt;&lt;a href="http://forums.techarena.in/windows-software/1163069.htm"&gt;http://www.microsoft.com/downloads/thankyou.aspx?familyId=21687628-5806-4ba6-9e4e-8e224ec6dd8c&amp;displayLang=en&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-4661950193314918698?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/4661950193314918698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=4661950193314918698' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/4661950193314918698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/4661950193314918698'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2009/08/how-to-disable-internet-explorer-8-from.html' title='How to disable Internet Explorer 8 From Installing With Automatic Updates'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-4513954514701323316</id><published>2009-08-15T22:34:00.000-07:00</published><updated>2009-08-15T23:36:59.492-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# Inheritance'/><category scheme='http://www.blogger.com/atom/ns#' term='C# log4net'/><title type='text'>Use log4net to Log Errors or Visitors</title><content type='html'>log4net is a free utility that can be used for logging data about errors or visitors. It is available here: &lt;a href="http://logging.apache.org/log4net/index.html"&gt;http://logging.apache.org/log4net/index.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here is an introductory article: &lt;a href="http://www.codeproject.com/KB/trace/Log4Net_with_ASP_NET.aspx"&gt;http://www.codeproject.com/KB/trace/Log4Net_with_ASP_NET.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I think a useful way to track users is to log users by their IP Address. Once your log4net is installed correctly, the following code in the Page_Load event can be used to write IP Addresses to a file placed in the App_Code folder (where it is not public):&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;        if (!Page.IsPostBack)&lt;br /&gt;        {&lt;br /&gt;            string nowip;&lt;br /&gt;            nowip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];&lt;br /&gt;            if (nowip == null)&lt;br /&gt;            {&lt;br /&gt;                nowip = Request.ServerVariables["REMOTE_ADDR"];&lt;br /&gt;            }&lt;br /&gt;            log.Info("Visitor IP: " + nowip);&lt;br /&gt;        }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I'll include the BasePage for a reference to the log variable above (which the System.Web.Page inherits from):&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System;&lt;br /&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Data;&lt;br /&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Configuration;&lt;br /&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Web;&lt;br /&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Web.Security;&lt;br /&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Web.UI;&lt;br /&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Web.UI.WebControls;&lt;br /&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Web.UI.WebControls.WebParts;&lt;br /&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Web.UI.HtmlControls;&lt;br /&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; log4net;&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; BasePage : System.Web.UI.Page&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;readonly&lt;/span&gt; ILog log = LogManager.GetLogger(&lt;span class="str"&gt;"Logger"&lt;/span&gt;);&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; BasePage()&lt;br /&gt;    {&lt;br /&gt;        initLog4Net();&lt;br /&gt;        &lt;span class="rem"&gt;//logAll();&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="rem"&gt;/// initializes Log4Net &lt;/span&gt;&lt;br /&gt;    &lt;span class="rem"&gt;/// Described at http://www.codeproject.com/KB/trace/Log4Net_with_ASP_NET.aspx&lt;/span&gt;&lt;br /&gt;    &lt;span class="rem"&gt;/// configured in web.config&lt;/span&gt;&lt;br /&gt;    &lt;span class="rem"&gt;///     level value can be ALL ERROR DEBUG FATAL DEBUG OFF WARN&lt;/span&gt;&lt;br /&gt;    &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; initLog4Net()&lt;br /&gt;    {&lt;br /&gt;        log4net.Config.XmlConfigurator.Configure();&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="rem"&gt;/// test log4net&lt;/span&gt;&lt;br /&gt;    &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; logAllTest()&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;bool&lt;/span&gt; isDebugEnabled = log.IsDebugEnabled;&lt;br /&gt;        &lt;span class="kwrd"&gt;bool&lt;/span&gt; isErrorEnabled = log.IsErrorEnabled;&lt;br /&gt;        &lt;span class="kwrd"&gt;bool&lt;/span&gt; isFatalEnabled = log.IsFatalEnabled;&lt;br /&gt;        &lt;span class="kwrd"&gt;bool&lt;/span&gt; isInfoEnabled = log.IsInfoEnabled;&lt;br /&gt;        &lt;span class="kwrd"&gt;bool&lt;/span&gt; isWarnEnabled = log.IsWarnEnabled;&lt;br /&gt;        log.Debug(&lt;span class="str"&gt;"Debug msg"&lt;/span&gt;);&lt;br /&gt;        log.Error(&lt;span class="str"&gt;"Error msg"&lt;/span&gt;);&lt;br /&gt;        log.Fatal(&lt;span class="str"&gt;"Fatal msg"&lt;/span&gt;);&lt;br /&gt;        log.Info(&lt;span class="str"&gt;"Info msg"&lt;/span&gt;);&lt;br /&gt;        log.Warn(&lt;span class="str"&gt;"Warn msg"&lt;/span&gt;);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;References: &lt;a href="http://www.aspxcode.net/free-asp-net-sample-source-code-c.aspx?Topics=how%20to%20get%20the%20IP%20Address%20of%20the%20Visitor"&gt;http://www.aspxcode.net/free-asp-net-sample-source-code-c.aspx?Topics=how%20to%20get%20the%20IP%20Address%20of%20the%20Visitor&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-4513954514701323316?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/4513954514701323316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=4513954514701323316' title='29 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/4513954514701323316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/4513954514701323316'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2009/08/use-log4net-to-log-errors-or-visitors.html' title='Use log4net to Log Errors or Visitors'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>29</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-5257083479952171291</id><published>2009-08-15T22:04:00.000-07:00</published><updated>2009-08-15T22:11:28.896-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# SQL Server'/><title type='text'>Sample SQLServer Databases</title><content type='html'>2005 and 2008 Sample SQLServer Databases are available here: &lt;a href="http://www.codeplex.com/MSFTDBProdSamples"&gt;MSFTDBProdSamples&lt;/a&gt;&lt;br /&gt;Northwind and pubs databases are available here: &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=06616212-0356-46A0-8DA2-EEBC53A68034&amp;displaylang=en"&gt;Northwind and pubs&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;These are useful for testing .NET Data objects by using SQLDatasource as the DataSource.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-5257083479952171291?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/5257083479952171291/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=5257083479952171291' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5257083479952171291'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5257083479952171291'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2009/08/sample-sqlserver-databases.html' title='Sample SQLServer Databases'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-1253891489409190776</id><published>2009-08-15T21:13:00.000-07:00</published><updated>2009-08-15T21:43:41.732-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CSS'/><category scheme='http://www.blogger.com/atom/ns#' term='C# GridView'/><title type='text'>Highlight Rows in a GridView</title><content type='html'>To highlight rows in a GridView you will want to use the GridView DataBound event to add the onmouseover and onmouseout attributes. While CSS methods may work in FireFox browsers, they do not work in Internet Explorer. For the associated javascript method, you can directly set it with this.style.backgroundColor, but this is inflexible. Instead, change the CSS class. &lt;br /&gt;&lt;br /&gt;Here is the CSS for the highlighted and normal row (see reference for source of the simple CSS):&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;style&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="text/css"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;.normalRow&lt;br /&gt;{&lt;br /&gt;background-color:white;/* You can update the background Color to normal Gridview Back Color */&lt;br /&gt;cursor:pointer;/* You can change cursor pointer to default, Pointer etc */&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.highlightRow&lt;br /&gt;{&lt;br /&gt;background-color:Gray;/* You can change the background Color of the row to whatever color you want. You can also give Hexadecimal color code also */&lt;br /&gt;cursor:pointer;/* You can change cursor pointer to default, Pointer etc */&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;style&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here is the CodeBehind for the GridView DataBound event:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; GridView1_DataBound(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (GridViewRow row &lt;span class="kwrd"&gt;in&lt;/span&gt; GridView1.Rows)&lt;br /&gt;        {&lt;br /&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (row.RowType == DataControlRowType.DataRow)&lt;br /&gt;            {&lt;br /&gt;                row.Attributes.Add(&lt;span class="str"&gt;"onmouseout"&lt;/span&gt;, &lt;span class="str"&gt;"this.className='normalRow'"&lt;/span&gt;);&lt;br /&gt;                row.Attributes.Add(&lt;span class="str"&gt;"onmouseover"&lt;/span&gt;, &lt;span class="str"&gt;"this.className='highlightRow'"&lt;/span&gt;);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Further modifications for multiple class rows can be made by checking the original CssClass (or checking implicitly by rowCount%currentRow for alternating rows) in the CodeBehind and setting the onmouseout event to switch back to that original class. Another example where this may be necessary is with check box rows that can be selected.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;References: &lt;ul&gt;&lt;li&gt;&lt;a href="http://www.mikesdotnetting.com/Article/37/How-to-highlight-a-GridView%27s-row-on-hover"&gt;http://www.mikesdotnetting.com/Article/37/How-to-highlight-a-GridView%27s-row-on-hover&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.dotnetspark.com/kb/673-highlight-row-gridview-on-mouseover-using.aspx"&gt;http://www.dotnetspark.com/kb/673-highlight-row-gridview-on-mouseover-using.aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-1253891489409190776?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/1253891489409190776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=1253891489409190776' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1253891489409190776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1253891489409190776'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2009/08/highlight-rows-in-gridview.html' title='Highlight Rows in a GridView'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-5189691880082779936</id><published>2009-08-15T20:36:00.000-07:00</published><updated>2009-08-15T20:38:07.972-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# GridView'/><title type='text'>Rid Grid Lines or Borders in a GridView</title><content type='html'>Here is how to get rid of Grid lines or borders in a GridView:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="GridView1"&lt;/span&gt; &lt;span class="attr"&gt;GridLines&lt;/span&gt;=&lt;span class="attr"&gt;None&lt;/span&gt;  &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;References: &lt;a href="http://forums.asp.net/t/1134618.aspx"&gt;http://forums.asp.net/t/1134618.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-5189691880082779936?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/5189691880082779936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=5189691880082779936' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5189691880082779936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5189691880082779936'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2009/08/rid-grid-lines-or-borders-in-gridview.html' title='Rid Grid Lines or Borders in a GridView'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-6359280162551930616</id><published>2009-08-15T20:17:00.000-07:00</published><updated>2009-08-15T20:25:35.856-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VB random'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>What are VB Me and MyBase Equivalents in C#?</title><content type='html'>What are VB Me and MyBase Equivalents in C#?&lt;br /&gt;&lt;table class=""&gt;&lt;br /&gt;            &lt;tr&gt;&lt;br /&gt;                &lt;td&gt;&lt;br /&gt;                    &lt;b&gt;VB&lt;/b&gt;&lt;/td&gt;&lt;br /&gt;                &lt;td&gt;&lt;br /&gt;                    &lt;b&gt;C#&lt;/b&gt;&lt;/td&gt;&lt;br /&gt;            &lt;/tr&gt;&lt;br /&gt;            &lt;tr&gt;&lt;br /&gt;                &lt;td&gt;&lt;br /&gt;                    Me&lt;/td&gt;&lt;br /&gt;                &lt;td&gt;&lt;br /&gt;                    this&lt;/td&gt;&lt;br /&gt;            &lt;/tr&gt;&lt;br /&gt;            &lt;tr&gt;&lt;br /&gt;                &lt;td&gt;&lt;br /&gt;                    MyBase&lt;/td&gt;&lt;br /&gt;                &lt;td&gt;&lt;br /&gt;                    base&lt;/td&gt;&lt;br /&gt;            &lt;/tr&gt;&lt;br /&gt;        &lt;/table&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-6359280162551930616?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/6359280162551930616/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=6359280162551930616' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6359280162551930616'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6359280162551930616'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2009/08/what-are-vb-me-and-mybase-equivalents.html' title='What are VB Me and MyBase Equivalents in C#?'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-2210036646138181629</id><published>2009-08-15T17:19:00.000-07:00</published><updated>2009-08-15T20:09:27.251-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Pageable'/><category scheme='http://www.blogger.com/atom/ns#' term='C# GridView'/><category scheme='http://www.blogger.com/atom/ns#' term='DataPageable'/><category scheme='http://www.blogger.com/atom/ns#' term='C# ADO'/><title type='text'>Creating a Pageable Gridview with Customized Pager Buttons</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_kfAAp8MWvgw/Sod4Hzfz47I/AAAAAAAAACs/nHO15DAJS4o/s1600-h/CustomPagerButtons.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 320px; height: 182px;" src="http://4.bp.blogspot.com/_kfAAp8MWvgw/Sod4Hzfz47I/AAAAAAAAACs/nHO15DAJS4o/s320/CustomPagerButtons.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5370393156140655538" /&gt;&lt;/a&gt;&lt;br /&gt;Matt Berseth put together a great post on creating a pageable GridView. It is basically a custom control that inherits from GridView and implements the DataPageable interface. The coolest part is how the GridView CSS is tailored to a specific looking type of Gridview. &lt;br /&gt;&lt;br /&gt;I think it is worth going one step further and tailoring the DataPager with custom images to indicate &lt;span style="font-weight:bold;"&gt;both&lt;/span&gt; enabled and disabled. You will notice that there is a FirstPageImageUrl in the NextPreviousPagerField but no available FirstPage_DisabledImageUrl. To overcome this, we need to examine the DataPager controls dynamically and switch the images according to whether we are already at the start index or last index. This code is placed in the GridView's DataBound event:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; gvProducts_DataBound(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            ImageButton ibtn;&lt;br /&gt;            &lt;span class="kwrd"&gt;int&lt;/span&gt; pgEnd = gvProducts.PageCount;&lt;br /&gt;            &lt;span class="kwrd"&gt;int&lt;/span&gt; curPg = gvProducts.PageIndex;&lt;br /&gt;            &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (Control ct &lt;span class="kwrd"&gt;in&lt;/span&gt; pager.Controls[0].Controls)&lt;br /&gt;            {&lt;br /&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt;(ct.GetType().Equals(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(ImageButton)))&lt;br /&gt;                {&lt;br /&gt;                    ibtn = ct &lt;span class="kwrd"&gt;as&lt;/span&gt; ImageButton;&lt;br /&gt;                    &lt;span class="kwrd"&gt;if&lt;/span&gt; (0 == curPg)&lt;br /&gt;                    {&lt;br /&gt;                        ibtn.ImageUrl = &lt;span class="str"&gt;"~/images/PageFirst_Disabled.jpg"&lt;/span&gt;;&lt;br /&gt;                    }&lt;br /&gt;                    &lt;span class="kwrd"&gt;else&lt;/span&gt; { ibtn.ImageUrl = &lt;span class="str"&gt;"~/images/PageFirst.jpg"&lt;/span&gt;; }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (Control ct &lt;span class="kwrd"&gt;in&lt;/span&gt; pager.Controls[2].Controls)&lt;br /&gt;            {&lt;br /&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt; (ct.GetType().Equals(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(ImageButton)))&lt;br /&gt;                {&lt;br /&gt;                    ibtn = ct &lt;span class="kwrd"&gt;as&lt;/span&gt; ImageButton;&lt;br /&gt;                    &lt;span class="kwrd"&gt;if&lt;/span&gt; ((pgEnd-1) == curPg)&lt;br /&gt;                    {&lt;br /&gt;                        ibtn.ImageUrl = &lt;span class="str"&gt;"~/images/PageLast_Disabled.jpg"&lt;/span&gt;;&lt;br /&gt;                    }&lt;br /&gt;                    &lt;span class="kwrd"&gt;else&lt;/span&gt; { ibtn.ImageUrl = &lt;span class="str"&gt;"~/images/PageLast.jpg"&lt;/span&gt;; }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I also changed the section in Matt's Default.aspx to:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;                            &lt;span class="rem"&gt;&amp;lt;!-- Notice this is outside the GridView --&amp;gt;&lt;/span&gt;&lt;br /&gt;                            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt; &lt;span class="attr"&gt;class&lt;/span&gt;&lt;span class="kwrd"&gt;="pager"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:DataPager&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="pager"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;PageSize&lt;/span&gt;&lt;span class="kwrd"&gt;="8"&lt;/span&gt; &lt;span class="attr"&gt;PagedControlID&lt;/span&gt;&lt;span class="kwrd"&gt;="gvProducts"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Fields&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                                        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:NextPreviousPagerField&lt;/span&gt;&lt;br /&gt;                                            &lt;span class="attr"&gt;ButtonType&lt;/span&gt;&lt;span class="kwrd"&gt;="Image"&lt;/span&gt;&lt;br /&gt;                                            &lt;span class="attr"&gt;FirstPageImageUrl&lt;/span&gt;&lt;span class="kwrd"&gt;="~/images/PageFirst.jpg"&lt;/span&gt;                                            &lt;br /&gt;                                            &lt;span class="attr"&gt;RenderDisabledButtonsAsLabels&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt; &lt;br /&gt;                                            &lt;span class="attr"&gt;ShowFirstPageButton&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt; &lt;span class="attr"&gt;ShowPreviousPageButton&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt; &lt;br /&gt;                                            &lt;span class="attr"&gt;ShowLastPageButton&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt; &lt;span class="attr"&gt;ShowNextPageButton&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt;&lt;br /&gt;                                        &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt; &lt;br /&gt;                                        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:NumericPagerField&lt;/span&gt;&lt;br /&gt;                                            &lt;span class="attr"&gt;ButtonCount&lt;/span&gt;&lt;span class="kwrd"&gt;="7"&lt;/span&gt; &lt;span class="attr"&gt;NumericButtonCssClass&lt;/span&gt;&lt;span class="kwrd"&gt;="command"&lt;/span&gt; &lt;br /&gt;                                            &lt;span class="attr"&gt;CurrentPageLabelCssClass&lt;/span&gt;&lt;span class="kwrd"&gt;="current"&lt;/span&gt; &lt;span class="attr"&gt;NextPreviousButtonCssClass&lt;/span&gt;&lt;span class="kwrd"&gt;="command"&lt;/span&gt;&lt;br /&gt;                                        &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                                        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:NextPreviousPagerField&lt;/span&gt; &lt;br /&gt;                                        &lt;br /&gt;                                            &lt;span class="attr"&gt;ButtonType&lt;/span&gt;&lt;span class="kwrd"&gt;="Image"&lt;/span&gt;&lt;br /&gt;                                            &lt;span class="attr"&gt;LastPageImageUrl&lt;/span&gt;&lt;span class="kwrd"&gt;="~/images/PageLast.jpg"&lt;/span&gt;&lt;br /&gt;                                            &lt;span class="attr"&gt;RenderDisabledButtonsAsLabels&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt; &lt;br /&gt;                                            &lt;span class="attr"&gt;ShowFirstPageButton&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt; &lt;span class="attr"&gt;ShowPreviousPageButton&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt; &lt;br /&gt;                                            &lt;span class="attr"&gt;ShowLastPageButton&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt; &lt;span class="attr"&gt;ShowNextPageButton&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt;&lt;br /&gt;                                        &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;                                            &lt;br /&gt;                                    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Fields&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;                            &lt;br /&gt;                                &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:DataPager&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The crude Microsoft Paint images are located here: &lt;a href="http://techron.scottrichmond.com/downloads/2210036646138181629images.zip"&gt;http://techron.scottrichmond.com/downloads/2210036646138181629images.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Now you know a technique to customize the DataPager. I further customized the buttons to display custom buttons (print, search, etc.) in the center and pager buttons on the right using JavaScript. That involves a lot of screen calculation details and JavaScript that is another topic. Note, the customization comes at a performance cost. This can be improved with direct reference to the control[x].FindControl("myImgControl"), but that requires inspecting how .NET names the ImageButton in the Debugger.&lt;br /&gt;&lt;br /&gt;The result is customized ImageButtons for enabled and disabled buttons.&lt;br /&gt;&lt;br /&gt;Download/view Matt's code to add in the customization I've written about.&lt;br /&gt;&lt;br /&gt;References: &lt;ul&gt;&lt;li&gt;&lt;a href="http://mattberseth.com/blog/2008/04/using_a_datapager_with_the_gri.html"&gt;http://mattberseth.com/blog/2008/04/using_a_datapager_with_the_gri.html&lt;/a&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;a href="http://www.c-sharpcorner.com/UploadFile/nipuntomar/DataPagerGridView08012008123240PM/DataPagerGridView.aspx"&gt;http://www.c-sharpcorner.com/UploadFile/nipuntomar/DataPagerGridView08012008123240PM/DataPagerGridView.aspx&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-2210036646138181629?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/2210036646138181629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=2210036646138181629' title='12 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2210036646138181629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2210036646138181629'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2009/08/creating-pageable-gridview-with.html' title='Creating a Pageable Gridview with Customized Pager Buttons'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_kfAAp8MWvgw/Sod4Hzfz47I/AAAAAAAAACs/nHO15DAJS4o/s72-c/CustomPagerButtons.jpg' height='72' width='72'/><thr:total>12</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-8553971717877978063</id><published>2009-08-15T17:08:00.000-07:00</published><updated>2009-08-15T17:15:28.501-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# ConnectionString'/><title type='text'>Use a Class to Store ConnectionString</title><content type='html'>This appears the best way to store database ConnectionString objects in a given Class:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;internal&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; GetConnectionString(&lt;span class="kwrd"&gt;string&lt;/span&gt; specifiedConnectionString, &lt;span class="kwrd"&gt;bool&lt;/span&gt; lookupConnectionString, &lt;span class="kwrd"&gt;bool&lt;/span&gt; appLevel)&lt;br /&gt;        {&lt;br /&gt;           &lt;span class="rem"&gt;//Your Conn String goes here!!&lt;/span&gt;&lt;br /&gt;           &lt;span class="kwrd"&gt;return&lt;/span&gt; Factory.ConnectionString;&lt;br /&gt;        }&lt;/pre&gt;&lt;br /&gt;Notice that a static Class is used since we don't need to waste memory instantiating strings.&lt;br /&gt;&lt;br /&gt;References: &lt;a href="http://forums.asp.net/p/997608/2209437.aspx"&gt;http://forums.asp.net/p/997608/2209437.aspx&lt;/a&gt;&lt;br /&gt;Specifically mentioned was to modify the SQLConnectionHelper.cs from: &lt;a href="http://download.microsoft.com/download/a/b/3/ab3c284b-dc9a-473d-b7e3-33bacfcc8e98/ProviderToolkitSamples.msi"&gt;http://download.microsoft.com/download/a/b/3/ab3c284b-dc9a-473d-b7e3-33bacfcc8e98/ProviderToolkitSamples.msi&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-8553971717877978063?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/8553971717877978063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=8553971717877978063' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8553971717877978063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8553971717877978063'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2009/08/use-class-to-store-connectionstring.html' title='Use a Class to Store ConnectionString'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-1485870784685516559</id><published>2009-08-15T17:00:00.000-07:00</published><updated>2009-08-15T17:08:10.045-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DataTable'/><category scheme='http://www.blogger.com/atom/ns#' term='DataSet'/><category scheme='http://www.blogger.com/atom/ns#' term='C# ADO'/><title type='text'>Use Column Mapping with MappingType.Hidden to Hide Columns in a DataTable</title><content type='html'>It is possible to use Column mapping with MappingType.Hidden to hide columns in a DataTable of a Dataset before the Fill with the following:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;myDS.Tables[0].Columns[i].ColumnMapping = MappingType.Hidden;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Of course, 0 may be substituted with the table name as a string. Unfortunately, this is not very useful if the Fill has already created the DataSet. In that case I would probable just want to use an item template in my data display control (such as a GridView) to output the specific fields. The other option is to run the delete columns on the DataTable, which is simply inefficient. Another losing option is to run a select command on the DataTable, which might have its uses for simply acquiring in memory data as opposed to viewing it.&lt;br /&gt;&lt;br /&gt;References: &lt;a href="http://www.dotnetspider.com/forum/ViewForum.aspx?ForumId=3888"&gt;http://www.dotnetspider.com/forum/ViewForum.aspx?ForumId=3888&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-1485870784685516559?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/1485870784685516559/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=1485870784685516559' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1485870784685516559'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1485870784685516559'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2009/08/use-column-mapping-with.html' title='Use Column Mapping with MappingType.Hidden to Hide Columns in a DataTable'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-5457701506200368900</id><published>2009-08-15T16:50:00.000-07:00</published><updated>2009-08-15T16:57:01.715-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='leading 0s'/><title type='text'>Create a Column in Excel with Leading 0s</title><content type='html'>To create a column in Excel with leading 0s given a column A with values 0,1,..., and 12 character string to create, use this formula on the target column:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;= RIGHT(&lt;span class="str"&gt;"000000000000"&lt;/span&gt; &amp;amp; A1,12)&lt;/pre&gt;&lt;br /&gt;The result will be 000000000000,000000000001,...&lt;br /&gt;Then just use the copy, paste special as values technique mentioned earlier.&lt;br /&gt;&lt;br /&gt;Reference: &lt;a href="http://www.koozie.org/2004/11/excel_leading_z.html"&gt;http://www.koozie.org/2004/11/excel_leading_z.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-5457701506200368900?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/5457701506200368900/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=5457701506200368900' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5457701506200368900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5457701506200368900'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2009/08/create-column-in-excel-with-leading-0s.html' title='Create a Column in Excel with Leading 0s'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-2129166156314637794</id><published>2009-08-15T16:44:00.000-07:00</published><updated>2009-08-15T16:49:06.071-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Excel'/><category scheme='http://www.blogger.com/atom/ns#' term='concatenate columns'/><title type='text'>Concatenate two Excel Columns with a Character or String</title><content type='html'>To concatenate (or join) two columns A2 and B2 into C2 with a hypen (in this case), use this formula in C2: &lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;=A2&amp;amp;&lt;span class="str"&gt;"-"&lt;/span&gt;&amp;amp;B2&lt;/pre&gt;&lt;br /&gt;Then copy the results down the column with click and drag downwards to duplicate the formula on the cell. Finally, copy column C and paste special into the target column as &lt;span style="font-style:italic;"&gt;values only&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Reference: &lt;a href="http://www.pcmag.com/article2/0,2817,33100,00.asp"&gt;http://www.pcmag.com/article2/0,2817,33100,00.asp&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-2129166156314637794?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/2129166156314637794/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=2129166156314637794' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2129166156314637794'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2129166156314637794'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2009/08/concatenate-two-excel-columns-with.html' title='Concatenate two Excel Columns with a Character or String'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-6563130134921264626</id><published>2009-08-15T16:38:00.000-07:00</published><updated>2009-08-15T16:42:05.642-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# GUID'/><title type='text'>How to Create  GUID from a String</title><content type='html'>This is an easy way, but esoteric task, to create a GUID from a string:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;Guid g = &lt;span class="kwrd"&gt;new&lt;/span&gt; Guid(&lt;span class="kwrd"&gt;string&lt;/span&gt;); &lt;/pre&gt;&lt;br /&gt;Reference: &lt;a href="http://www.devnewsgroups.net/dotnetframework/t2650-convert-string-guid.aspx"&gt;http://www.devnewsgroups.net/dotnetframework/t2650-convert-string-guid.aspx &lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-6563130134921264626?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/6563130134921264626/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=6563130134921264626' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6563130134921264626'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6563130134921264626'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2009/08/how-to-create-guid-from-string.html' title='How to Create  GUID from a String'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-3117566346224756048</id><published>2009-08-15T09:50:00.000-07:00</published><updated>2009-08-15T09:54:10.611-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Group Policy'/><category scheme='http://www.blogger.com/atom/ns#' term='Administration'/><category scheme='http://www.blogger.com/atom/ns#' term='Vista'/><title type='text'>Using Vista to Add a User Account to a Group</title><content type='html'>Here is a helpful description of how to add a user account to a group. Of course you probably need Vista Business or Ultimate.&lt;br /&gt;&lt;br /&gt;Reference: &lt;a href="http://windowshelp.microsoft.com/Windows/en-US/help/0faddcfc-e2a9-4297-a429-3f7e83fe6e361033.mspx"&gt;Using Vista to Add a User Account to a Group&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-3117566346224756048?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/3117566346224756048/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=3117566346224756048' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3117566346224756048'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3117566346224756048'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2009/08/using-vista-to-add-user-account-to.html' title='Using Vista to Add a User Account to a Group'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-7916566480668296129</id><published>2009-04-14T16:22:00.000-07:00</published><updated>2009-04-14T16:29:12.702-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='graph'/><category scheme='http://www.blogger.com/atom/ns#' term='.NET 3.5'/><category scheme='http://www.blogger.com/atom/ns#' term='Microsoft Charts'/><title type='text'>Getting Started With Microsoft Charts</title><content type='html'>I just ran across a &lt;a href="http://www.dotnettutorials.com/tutorials/charts/ms-chart-line-graph-cs.aspx"&gt;tutorial &lt;/a&gt;on getting started with Microsoft Charts for ASP.NET 3.5. The pre-requisite is to download the chart.exe from &lt;a href="http://code.msdn.microsoft.com/mschart"&gt;http://code.msdn.microsoft.com/mschart&lt;/a&gt; Specifically, I clicked the "Chart Controls for .NET Framework" link on that page to download MSChart.exe.&lt;br /&gt;&lt;br /&gt;Microsoft offered this in response to Googles Charts by buying Dundee's Charts that was for .NET 2.0. Note, this new one is for 3.5.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-7916566480668296129?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/7916566480668296129/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=7916566480668296129' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/7916566480668296129'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/7916566480668296129'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2009/04/getting-started-with-microsoft-charts.html' title='Getting Started With Microsoft Charts'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-7258759243473433662</id><published>2009-03-31T10:37:00.001-07:00</published><updated>2009-03-31T10:40:50.123-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server Management Studio Express'/><category scheme='http://www.blogger.com/atom/ns#' term='C# SQL Server'/><title type='text'>SQL Server 2005 database diagram support objects error</title><content type='html'>Sql 2005 Database diagram support objects cannot be installed because this database does not have a valid owner...&lt;br /&gt;&lt;br /&gt;Solution:&lt;br /&gt;1. Right Click on your database, choose properties&lt;br /&gt;2. Goto the Options Page&lt;br /&gt;3. In the Dropdown at right labeled "Compatibility Level" choose "SQL Server 2005(90)"&lt;br /&gt;4. Goto the Files Page&lt;br /&gt;5. Enter "sa" in the owner textbox.&lt;br /&gt;6. Hit OK&lt;br /&gt;&lt;br /&gt;Reference: &lt;a href="http://geekswithblogs.net/shahed/archive/2007/11/19/116940.aspx"&gt;http://geekswithblogs.net/shahed/archive/2007/11/19/116940.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-7258759243473433662?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/7258759243473433662/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=7258759243473433662' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/7258759243473433662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/7258759243473433662'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2009/03/sql-server-2005-database-diagram.html' title='SQL Server 2005 database diagram support objects error'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-8068962312093071623</id><published>2009-03-19T15:13:00.001-07:00</published><updated>2009-03-19T15:19:22.297-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Trigger'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Error'/><title type='text'>Incorrect Syntax Near sproc ...</title><content type='html'>I got this 'incorrect syntax near spoc (stored procedure)' error from the following:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; connectionString = getConnectionString(&lt;span class="str"&gt;"ConnectionString"&lt;/span&gt;);&lt;br /&gt;        SqlConnection conn = &lt;span class="kwrd"&gt;new&lt;/span&gt; SqlConnection(connectionString);&lt;br /&gt;        System.Data.SqlClient.SqlCommand command = &lt;span class="kwrd"&gt;new&lt;/span&gt; System.Data.SqlClient.SqlCommand(&lt;span class="str"&gt;"sproc_aspnet_StocksInLists_RemoveStocksFromList"&lt;/span&gt;, conn);&lt;br /&gt;        &lt;br /&gt;        &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            conn.Open();&lt;br /&gt;            command.Parameters.AddWithValue(&lt;span class="str"&gt;"@ListId"&lt;/span&gt;, ddlList.SelectedValue);&lt;br /&gt;            iRes = command.ExecuteNonQuery();&lt;br /&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (iRes &amp;lt; 0) &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; Exception(&lt;span class="str"&gt;"Error removing stocks from list"&lt;/span&gt;);&lt;br /&gt;        }&lt;/pre&gt;The bug fix is to set the command type: &lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; connectionString = getConnectionString(&lt;span class="str"&gt;"ConnectionString"&lt;/span&gt;);&lt;br /&gt;        SqlConnection conn = &lt;span class="kwrd"&gt;new&lt;/span&gt; SqlConnection(connectionString);&lt;br /&gt;        System.Data.SqlClient.SqlCommand command = &lt;span class="kwrd"&gt;new&lt;/span&gt; System.Data.SqlClient.SqlCommand(&lt;span class="str"&gt;"sproc_aspnet_StocksInLists_RemoveStocksFromList"&lt;/span&gt;, conn);&lt;br /&gt;        command.CommandType = System.Data.CommandType.StoredProcedure;&lt;br /&gt;        &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            conn.Open();&lt;br /&gt;            command.Parameters.AddWithValue(&lt;span class="str"&gt;"@ListId"&lt;/span&gt;, ddlList.SelectedValue);&lt;br /&gt;            iRes = command.ExecuteNonQuery();&lt;br /&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (iRes &amp;lt; 0) &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; Exception(&lt;span class="str"&gt;"Error removing stocks from list"&lt;/span&gt;);&lt;br /&gt;        }&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-8068962312093071623?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/8068962312093071623/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=8068962312093071623' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8068962312093071623'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8068962312093071623'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2009/03/incorrect-syntax-near-sproc.html' title='Incorrect Syntax Near sproc ...'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-1455874100107030783</id><published>2008-12-23T13:54:00.000-08:00</published><updated>2008-12-23T14:00:03.258-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# Google Charts'/><title type='text'>Add Google Charts with .NET</title><content type='html'>Add Google Charts with .NET.&lt;br /&gt;Go to: &lt;a href="http://code.google.com/p/googlechartsharp/"&gt;http://code.google.com/p/googlechartsharp/&lt;/a&gt;&lt;br /&gt;Download DLL.&lt;br /&gt;Save and Unzip to location.&lt;br /&gt;&lt;br /&gt;From your project, add reference.&lt;br /&gt;Select DLL.&lt;br /&gt;Copy source code from below:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="rem"&gt;// using GoogleChartSharp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt;[] data = &lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;int&lt;/span&gt;[] { 40, 30, 20, 10, 0 };&lt;br /&gt;&lt;br /&gt;        &lt;span class="rem"&gt;// Specify chart width and height in pixels&lt;/span&gt;&lt;br /&gt;        LineChart chart = &lt;span class="kwrd"&gt;new&lt;/span&gt; LineChart(150, 150);&lt;br /&gt;&lt;br /&gt;        &lt;span class="rem"&gt;// SetData will accept int[] and float[] for single data sets&lt;/span&gt;&lt;br /&gt;        chart.SetData(data);&lt;br /&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; imageUrl = chart.GetUrl();&lt;br /&gt;        Image1.ImageUrl = imageUrl;&lt;/pre&gt;Run. Enjoy. Modify. Visit these sites for more:&lt;br /&gt;&lt;a href="http://groups.google.com/group/google-chart-api/web/useful-links-to-api-libraries"&gt;http://groups.google.com/group/google-chart-api/web/useful-links-to-api-libraries&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;References:&lt;br /&gt;&lt;a href="http://code.google.com/p/googlechartsharp/"&gt;http://code.google.com/p/googlechartsharp/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://code.google.com/p/googlechartsharp/wiki/UsageExamples"&gt;http://code.google.com/p/googlechartsharp/wiki/UsageExamples&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-1455874100107030783?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/1455874100107030783/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=1455874100107030783' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1455874100107030783'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1455874100107030783'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/12/add-google-charts-with-net.html' title='Add Google Charts with .NET'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-1619115263132524487</id><published>2008-12-23T13:51:00.001-08:00</published><updated>2008-12-23T13:54:24.338-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# Stored Procedure'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Membership'/><title type='text'>Get the ApplicationName for Stored Procedure Parameter</title><content type='html'>Sometimes the ApplicatonName is necessary for Membership stored procedures. You can access the ApplicationName as follows:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; appName = Membership.ApplicationName;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;References: &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.security.membership.applicationname(VS.80).aspx"&gt;http://msdn.microsoft.com/en-us/library/system.web.security.membership.applicationname(VS.80).aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-1619115263132524487?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/1619115263132524487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=1619115263132524487' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1619115263132524487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1619115263132524487'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/12/get-applicationname-for-stored.html' title='Get the ApplicationName for Stored Procedure Parameter'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-5715432630698611514</id><published>2008-12-23T13:46:00.001-08:00</published><updated>2008-12-23T13:49:15.544-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='C# DateTime'/><title type='text'>Get the Current Time for Database Storage</title><content type='html'>To get the current datetime in UTC format in .net use following:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;DateTime dateUTC = DateTime.Now.ToUniversalTime();&lt;/pre&gt;You can then store this date in your database.&lt;br /&gt;If you want to display it back to local time use:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;DateTime dateLocal = dateUTC.ToLocalTime();&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Reference: &lt;a href="http://forums.asp.net/t/1217716.aspx"&gt;http://forums.asp.net/t/1217716.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-5715432630698611514?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/5715432630698611514/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=5715432630698611514' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5715432630698611514'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5715432630698611514'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/12/get-current-time-for-database-storage.html' title='Get the Current Time for Database Storage'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-429978556506803858</id><published>2008-12-23T13:42:00.000-08:00</published><updated>2008-12-23T13:45:37.764-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='C# SQL Server'/><title type='text'>The Difference Between NVARCHAR and VARCHAR</title><content type='html'>The main difference between NVARCHAR and VARCHAR is that NVARCHAR extra space allows for easier multi-language support. Therefore, I switched my database's VARCHARs to NVARCHARS. &lt;br /&gt;&lt;br /&gt;References: &lt;a href="http://july-code.blogspot.com/2008/03/differences-between-varchar-and.html"&gt;http://july-code.blogspot.com/2008/03/differences-between-varchar-and.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-429978556506803858?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/429978556506803858/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=429978556506803858' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/429978556506803858'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/429978556506803858'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/12/difference-between-nvarchar-and-varchar.html' title='The Difference Between NVARCHAR and VARCHAR'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-3728745494474666084</id><published>2008-12-23T13:31:00.000-08:00</published><updated>2008-12-23T13:41:47.257-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# config'/><category scheme='http://www.blogger.com/atom/ns#' term='C# ConnectionStringSettings'/><title type='text'>Accessing ConnectionString from CodeBehind</title><content type='html'>Accessing a ConnectionString from CodeBehind requires your connection string to be defined in the web.config file.&lt;br /&gt;&lt;br /&gt;Then use this source code:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;ConnectionString = System.Configuration.ConfigurationManager.AppSettings[&lt;span class="str"&gt;"MySetting"&lt;/span&gt;].ToString();&lt;/pre&gt;&lt;br /&gt;I customized my BasePage with a utility function as follows:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; getConnectionString(&lt;span class="kwrd"&gt;string&lt;/span&gt; vConnectionString)&lt;br /&gt;    {&lt;br /&gt;        System.Configuration.Configuration rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);&lt;br /&gt;        System.Configuration.ConnectionStringSettings connString = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; connectionString = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Empty;&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (0 &amp;lt; rootWebConfig.ConnectionStrings.ConnectionStrings.Count)&lt;br /&gt;        {&lt;br /&gt;            connString =&lt;br /&gt;                rootWebConfig.ConnectionStrings.ConnectionStrings[vConnectionString];&lt;br /&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (connString != &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;br /&gt;                connectionString = connString.ConnectionString;&lt;br /&gt;        }&lt;br /&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; connectionString;&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;References: &lt;a href="http://forums.asp.net/p/1353594/2770309.aspx"&gt;http://forums.asp.net/p/1353594/2770309.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/ms178411(VS.80).aspx"&gt;http://msdn.microsoft.com/en-us/library/ms178411(VS.80).aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-3728745494474666084?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/3728745494474666084/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=3728745494474666084' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3728745494474666084'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3728745494474666084'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/12/accessing-connectionstring-from.html' title='Accessing ConnectionString from CodeBehind'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-5611840639497964530</id><published>2008-12-23T13:20:00.000-08:00</published><updated>2008-12-23T13:29:47.021-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# config'/><category scheme='http://www.blogger.com/atom/ns#' term='C# ConnectionStringSettings'/><title type='text'>Use ConnectionString Web.config</title><content type='html'>I setup the ConnectionString in my Web.config file and encountered a "'ConnectionStringSettings' is not defined error. The solution was to add the 'system.configuration' library to the project! (Project, Add reference.., then find the library then add it!).&lt;br /&gt;&lt;br /&gt;References: &lt;a href="http://forums.asp.net/p/1047730/1475561.aspx#1475561"&gt;http://forums.asp.net/p/1047730/1475561.aspx#1475561&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-5611840639497964530?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/5611840639497964530/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=5611840639497964530' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5611840639497964530'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5611840639497964530'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/12/use-connectionstring-webconfig.html' title='Use ConnectionString Web.config'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-111577119853500269</id><published>2008-12-23T13:04:00.000-08:00</published><updated>2008-12-23T13:13:51.093-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# DropDownList'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Session'/><category scheme='http://www.blogger.com/atom/ns#' term='C# DataBinding'/><title type='text'>Keeping a DropDownList's DataSource Updated</title><content type='html'>The DropDownList does not manage selected state like other controls. Therefore, I use a Session variable to store an index to keep track of the currently selected item:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Page_Load(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (!Page.IsPostBack)&lt;br /&gt;        {&lt;br /&gt;            Session[&lt;span class="str"&gt;"listId"&lt;/span&gt;] = ddlList.SelectedValue;&lt;br /&gt;            GridViewStocksInLists.DataBind();&lt;br /&gt;        }&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;Now, I add the SelectedIndexChanged event with the following code:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; ddlList_SelectedIndexChanged(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        Session[&lt;span class="str"&gt;"listId"&lt;/span&gt;] = ddlList.SelectedValue;&lt;br /&gt;        GridViewStocksInLists.DataBind();&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;Reference: &lt;a href="http://www.velocityreviews.com/forums/t123449-problem-with-formview-and-dropdownlists.html"&gt;http://www.velocityreviews.com/forums/t123449-problem-with-formview-and-dropdownlists.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-111577119853500269?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/111577119853500269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=111577119853500269' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/111577119853500269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/111577119853500269'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/12/keeping-dropdownlists-datasource.html' title='Keeping a DropDownList&apos;s DataSource Updated'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-4950735397173747819</id><published>2008-12-23T12:49:00.001-08:00</published><updated>2008-12-23T12:55:46.318-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# DataBinding'/><category scheme='http://www.blogger.com/atom/ns#' term='C# CustomControl'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Membership'/><category scheme='http://www.blogger.com/atom/ns#' term='C# ADO'/><title type='text'>Use a CustomControl to Set UserId and Use as a DataBindable Property</title><content type='html'>Use a CustomControl (named MembershipUser) to Set UserId and Use as a DataBindable Property. Create a MembershipUser CustomControl that has a property named Value that can be DataBound. For example MembershipUser1.Value would fetch the userId:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    [Browsable (&lt;span class="kwrd"&gt;true&lt;/span&gt;)]&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Value&lt;br /&gt;    {&lt;br /&gt;        get&lt;br /&gt;        {&lt;br /&gt;            MembershipUser currentUser;&lt;br /&gt;            currentUser = Membership.GetUser();&lt;br /&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (currentUser == &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;br /&gt;                &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt;.Empty;&lt;br /&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; currentUser.ProviderUserKey.ToString();&lt;br /&gt;        }&lt;br /&gt;    }&lt;/pre&gt;Reference: This is from &lt;a href="http://aspnet.4guysfromrolla.com/articles/110106-1.aspx"&gt;http://aspnet.4guysfromrolla.com/articles/110106-1.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-4950735397173747819?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/4950735397173747819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=4950735397173747819' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/4950735397173747819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/4950735397173747819'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/12/use-customcontrol-to-set-userid-and-use.html' title='Use a CustomControl to Set UserId and Use as a DataBindable Property'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-2032632399547215237</id><published>2008-12-23T12:40:00.000-08:00</published><updated>2008-12-23T12:47:44.987-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# Stored Procedure'/><category scheme='http://www.blogger.com/atom/ns#' term='C# DataBinding'/><title type='text'>Be Careful About uniqueId Parameter in Stored Procedure</title><content type='html'>Here is an error I received when my UniqueId parameter in a stored procedure was not valid:&lt;br /&gt;&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;Server Error in '/stockmonger.com' Application.&lt;br /&gt;Conversion failed when converting from a character string to uniqueidentifier.&lt;br /&gt;Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.&lt;br /&gt;&lt;br /&gt;Exception Details: System.Data.SqlClient.SqlException: Conversion failed when converting from a character string to uniqueidentifier.&lt;br /&gt;&lt;br /&gt;Source Error:&lt;br /&gt;&lt;br /&gt;An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;I corrected to make sure the parameter was a valid uniqueId paramater and not null.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-2032632399547215237?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/2032632399547215237/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=2032632399547215237' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2032632399547215237'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2032632399547215237'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/12/be-careful-about-uniqueid-parameter-in.html' title='Be Careful About uniqueId Parameter in Stored Procedure'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-5456414552270426753</id><published>2008-12-23T12:28:00.000-08:00</published><updated>2008-12-23T12:37:09.309-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# HyperLink'/><category scheme='http://www.blogger.com/atom/ns#' term='C# String'/><category scheme='http://www.blogger.com/atom/ns#' term='C# GridView'/><category scheme='http://www.blogger.com/atom/ns#' term='C# ADO'/><title type='text'>Modifying DataBound Hyperlinks Text</title><content type='html'>Modifying a GridView's Databound Hyperlink text since I couldn't do this easily in the ItemTemplate, I moved the Replace function to the DataBound of the GridView:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; GridViewStocksInLists_DataBound(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; rowId;&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; imgUrl;&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; navUrl;&lt;br /&gt;        &lt;span class="kwrd"&gt;for&lt;/span&gt; (rowId=0; rowId&amp;lt;GridViewStocksInLists.Rows.Count;rowId++) {&lt;br /&gt;            imgUrl = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Empty;&lt;br /&gt;            navUrl = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Empty;&lt;br /&gt;            imgUrl = ((HyperLink)GridViewStocksInLists.Rows[rowId].FindControl(&lt;span class="str"&gt;"hlChart"&lt;/span&gt;)).ImageUrl.Replace(&lt;span class="str"&gt;'$'&lt;/span&gt;, &lt;span class="str"&gt;'^'&lt;/span&gt;);&lt;br /&gt;            ((HyperLink)GridViewStocksInLists.Rows[rowId].FindControl(&lt;span class="str"&gt;"hlChart"&lt;/span&gt;)).ImageUrl = imgUrl;&lt;br /&gt;            navUrl = ((HyperLink)GridViewStocksInLists.Rows[rowId].FindControl(&lt;span class="str"&gt;"hlChart"&lt;/span&gt;)).NavigateUrl.Replace(&lt;span class="str"&gt;'$'&lt;/span&gt;, &lt;span class="str"&gt;'^'&lt;/span&gt;);&lt;br /&gt;            ((HyperLink)GridViewStocksInLists.Rows[rowId].FindControl(&lt;span class="str"&gt;"hlChart"&lt;/span&gt;)).NavigateUrl = navUrl;&lt;br /&gt;        }&lt;br /&gt;    }&lt;/pre&gt;This replaced $ with ^ in my HyperLink.&lt;br /&gt;&lt;br /&gt;Here is the GridView that contains the HyperLink:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="GridViewStocksInLists"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;DataSourceID&lt;/span&gt;&lt;span class="kwrd"&gt;="SqlDataSourceGetStocksInList"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;RowStyle&lt;/span&gt; &lt;span class="attr"&gt;CssClass&lt;/span&gt;&lt;span class="kwrd"&gt;="tableAnalysisRow"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;HeaderStyle&lt;/span&gt; &lt;span class="attr"&gt;CssClass&lt;/span&gt;&lt;span class="kwrd"&gt;="tableAnalysisHeader"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;AlternatingRowStyle&lt;/span&gt; &lt;span class="attr"&gt;CssClass&lt;/span&gt;&lt;span class="kwrd"&gt;="tableAnalysisAlternatingRow"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Columns&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;                  &lt;br /&gt;                        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:TemplateField&lt;/span&gt; &lt;span class="attr"&gt;HeaderText&lt;/span&gt;&lt;span class="kwrd"&gt;="Chart"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:HyperLink&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="hlChart"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt;&lt;br /&gt;                                &lt;span class="attr"&gt;ImageUrl&lt;/span&gt;&lt;span class="kwrd"&gt;='&amp;lt;%# Eval("Symbol", "http://chart.finance.yahoo.com/c/0b/d/{0}").ToLower() %&amp;gt;'&lt;/span&gt;&lt;br /&gt;                                &lt;span class="attr"&gt;NavigateUrl&lt;/span&gt;&lt;span class="kwrd"&gt;='&amp;lt;%# Eval("Symbol", "http://finance.yahoo.com/q/bc?s={0}&amp;amp;t=1y").ToLower() %&amp;gt;'&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                                &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:HyperLink&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:TemplateField&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Columns&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;References: &lt;a href="http://forums.asp.net/p/1263726/2542303.aspx#2542303"&gt;http://forums.asp.net/p/1263726/2542303.aspx#2542303&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-5456414552270426753?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/5456414552270426753/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=5456414552270426753' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5456414552270426753'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5456414552270426753'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/12/modifying-databound-hyperlinks-text.html' title='Modifying DataBound Hyperlinks Text'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-210791162794827205</id><published>2008-12-23T12:02:00.000-08:00</published><updated>2008-12-23T12:08:22.906-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# regex'/><category scheme='http://www.blogger.com/atom/ns#' term='C# String'/><title type='text'>Remove HTML Tags</title><content type='html'>Remove HTML Tags from a string:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; RemoveHtml(&lt;span class="kwrd"&gt;string&lt;/span&gt; txt)  &lt;br /&gt;    {  &lt;br /&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; Regex.Replace(txt, &lt;span class="str"&gt;@"&amp;lt;[^&amp;gt;]*&amp;gt;"&lt;/span&gt;, &lt;span class="kwrd"&gt;string&lt;/span&gt;.Empty);  &lt;br /&gt;    } &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Reference: &lt;a href="http://www.webpronews.com/expertarticles/2006/12/01/aspnet-remove-html-tags-from-a-string"&gt;http://www.webpronews.com/expertarticles/2006/12/01/aspnet-remove-html-tags-from-a-string&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-210791162794827205?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/210791162794827205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=210791162794827205' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/210791162794827205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/210791162794827205'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/12/remove-html-tags.html' title='Remove HTML Tags'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-8350647057738638849</id><published>2008-12-17T23:00:00.000-08:00</published><updated>2008-12-17T23:43:30.032-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='C# javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='C# AutoComplete'/><title type='text'>Using AutoComplete Ajax Control With Separate ID Field from Name Field</title><content type='html'>In the &lt;a href="http://techron.blogspot.com/2008/12/using-like-in-sql.html"&gt;previous post&lt;/a&gt;, I detailed how to use the SQL stored procedure to select matches. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx"&gt;AutoComplete Extender&lt;/a&gt; offers a convenient way to select values froma TextBox. One problem is that multiple details can be displayed, but the whole text is selected by default. I wanted to allow multiple AutoCompletes, select the id without the other details and append the appropriate delimeter in between entries. First, I setup the WebService method. Note that the Stock object has Symbol and Name properties:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;   [WebMethod]&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt;[] GetStocksInPrefix(&lt;span class="kwrd"&gt;string&lt;/span&gt; prefixText, &lt;span class="kwrd"&gt;int&lt;/span&gt; count)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; curCount = 0;&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (count == 0)&lt;br /&gt;        {&lt;br /&gt;            count = 10;&lt;br /&gt;        }&lt;br /&gt;        List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt; items = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;&lt;span class="kwrd"&gt;string&lt;/span&gt;&amp;gt;();&lt;br /&gt;        JavaScriptSerializer jss = &lt;span class="kwrd"&gt;new&lt;/span&gt; JavaScriptSerializer();&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt;[] stocks = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; connectionString = getConnectionString(&lt;span class="str"&gt;"ConnectionString"&lt;/span&gt;);&lt;br /&gt;        SqlDataReader rdr = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;br /&gt;        SqlConnection conn = &lt;span class="kwrd"&gt;new&lt;/span&gt; SqlConnection(connectionString);&lt;br /&gt;        System.Data.SqlClient.SqlCommand command = &lt;span class="kwrd"&gt;new&lt;/span&gt; System.Data.SqlClient.SqlCommand(&lt;span class="str"&gt;"sproc_aspnet_GetStocksByPrefix"&lt;/span&gt;, conn);&lt;br /&gt;        &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            command.CommandType = System.Data.CommandType.StoredProcedure;&lt;br /&gt;            conn.Open();&lt;br /&gt;            command.Parameters.AddWithValue(&lt;span class="str"&gt;"@Prefix"&lt;/span&gt;, prefixText+&lt;span class="str"&gt;"%"&lt;/span&gt;);&lt;br /&gt;            rdr = command.ExecuteReader();&lt;br /&gt;            &lt;span class="kwrd"&gt;string&lt;/span&gt; tmp = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Empty;&lt;br /&gt;            Stock _stock = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;br /&gt;            &lt;span class="kwrd"&gt;while&lt;/span&gt; (rdr.Read() &amp;amp;&amp;amp; curCount&amp;lt;count )&lt;br /&gt;            {&lt;br /&gt;                _stock = &lt;span class="kwrd"&gt;new&lt;/span&gt; Stock(rdr[&lt;span class="str"&gt;"Symbol"&lt;/span&gt;].ToString(), rdr[&lt;span class="str"&gt;"Name"&lt;/span&gt;].ToString(), rdr[&lt;span class="str"&gt;"Exchange"&lt;/span&gt;].ToString());&lt;br /&gt;                tmp = rdr[&lt;span class="str"&gt;"Symbol"&lt;/span&gt;] + &lt;span class="str"&gt;"\t"&lt;/span&gt; + rdr[&lt;span class="str"&gt;"Name"&lt;/span&gt;];&lt;br /&gt;                items.Add(AutoCompleteExtender.CreateAutoCompleteItem(tmp, jss.Serialize(_stock)));&lt;br /&gt;                curCount++;&lt;br /&gt;            }&lt;br /&gt;            command.Parameters.Clear();&lt;br /&gt;        }&lt;br /&gt;        &lt;span class="kwrd"&gt;catch&lt;/span&gt; (Exception ex)&lt;br /&gt;        {&lt;br /&gt;        }&lt;br /&gt;        &lt;span class="kwrd"&gt;finally&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (rdr != &lt;span class="kwrd"&gt;null&lt;/span&gt;) rdr.Close();&lt;br /&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt;(conn!=&lt;span class="kwrd"&gt;null&lt;/span&gt;) conn.Close();&lt;br /&gt;        }&lt;br /&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; items.ToArray();&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Then, I add the javascript event, 'OnSymbolSelected',to the OnClientItemSelected event in the AutoComplete Extender:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:TextBox&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="txtSymbols"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;Width&lt;/span&gt;&lt;span class="kwrd"&gt;="300px"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:TextBox&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;cc1:AutoCompleteExtender&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="AutoCompleteExtender1"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;br /&gt;                        &lt;span class="attr"&gt;TargetControlID&lt;/span&gt;&lt;span class="kwrd"&gt;="txtSymbols"&lt;/span&gt; &lt;span class="attr"&gt;ServiceMethod&lt;/span&gt;&lt;span class="kwrd"&gt;="GetStocksInPrefix"&lt;/span&gt; &lt;br /&gt;                        &lt;span class="attr"&gt;ServicePath&lt;/span&gt;&lt;span class="kwrd"&gt;="~/WebServiceAutoCompleteSymbol.asmx"&lt;/span&gt; &lt;span class="attr"&gt;MinimumPrefixLength&lt;/span&gt;&lt;span class="kwrd"&gt;="2"&lt;/span&gt;&lt;br /&gt;                        &lt;span class="attr"&gt;CompletionListHighlightedItemCssClass&lt;/span&gt;&lt;span class="kwrd"&gt;="watermark"&lt;/span&gt; &lt;span class="attr"&gt;CompletionSetCount&lt;/span&gt;&lt;span class="kwrd"&gt;="10"&lt;/span&gt;&lt;br /&gt;                        &lt;span class="attr"&gt;DelimiterCharacters&lt;/span&gt;&lt;span class="kwrd"&gt;=", "&lt;/span&gt;&lt;br /&gt;                        &lt;span class="attr"&gt;CompletionListElementID&lt;/span&gt;&lt;span class="kwrd"&gt;="Symbol"&lt;/span&gt;&lt;br /&gt;                        &lt;span class="attr"&gt;CompletionListItemCssClass&lt;/span&gt;&lt;span class="kwrd"&gt;="watermarkMatch"&lt;/span&gt;                        &lt;br /&gt;                        &lt;span class="attr"&gt;EnableCaching&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt; &lt;span class="attr"&gt;CompletionInterval&lt;/span&gt;&lt;span class="kwrd"&gt;="1000"&lt;/span&gt; &lt;span class="attr"&gt;OnClientItemSelected&lt;/span&gt;&lt;span class="kwrd"&gt;="OnSymbolSelected"&lt;/span&gt;&lt;br /&gt;                         &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;cc1:AutoCompleteExtender&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Finally, add the javascript function to the aspx page. This function reads the Stock object into results, takes the SelectedText and gets the original string before the new text was completed by replacing the completed text with an empty string. If it is an additional field (that does not contain ' ' or ',', then only the id (symbol in this case) is added. Othewise, the original id plus the ' ' delimeter and the new id is added:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="text/javascript"&lt;/span&gt; &lt;span class="attr"&gt;language&lt;/span&gt;&lt;span class="kwrd"&gt;="javascript"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;   &lt;br /&gt;    &lt;span class="kwrd"&gt;function&lt;/span&gt; OnSymbolSelected(source, eventArgs)   &lt;br /&gt;    {   &lt;br /&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; results = eval(&lt;span class="str"&gt;'('&lt;/span&gt;  + eventArgs.get_value() + &lt;span class="str"&gt;')'&lt;/span&gt;);   &lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (results.symbol != &lt;span class="kwrd"&gt;null&lt;/span&gt;)   {  &lt;br /&gt;            &lt;span class="kwrd"&gt;var&lt;/span&gt; symbols = document.getElementById(&lt;span class="str"&gt;'&amp;lt;%= txtSymbols.ClientID %&amp;gt;'&lt;/span&gt;).value;&lt;br /&gt;            &lt;span class="kwrd"&gt;var&lt;/span&gt; original = symbols.replace((results.symbol+&lt;span class="str"&gt;'\t'&lt;/span&gt;+results.name),&lt;span class="str"&gt;''&lt;/span&gt;);&lt;br /&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (original.indexOf(&lt;span class="str"&gt;' '&lt;/span&gt;)&amp;gt;0 || original.indexOf(&lt;span class="str"&gt;','&lt;/span&gt;)&amp;gt;0)&lt;br /&gt;                document.getElementById(&lt;span class="str"&gt;'&amp;lt;%= txtSymbols.ClientID %&amp;gt;'&lt;/span&gt;).value = original + (&lt;span class="str"&gt;' '&lt;/span&gt;+ results.symbol);&lt;br /&gt;            &lt;span class="kwrd"&gt;else&lt;/span&gt;  &lt;br /&gt;                document.getElementById(&lt;span class="str"&gt;'&amp;lt;%= txtSymbols.ClientID %&amp;gt;'&lt;/span&gt;).value = results.symbol;&lt;br /&gt;            }&lt;br /&gt;    }   &lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;  &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;References: &lt;a href="http://ziqbalbh.wordpress.com/2008/06/11/google-like-autocomplete-suggestions/"&gt;http://ziqbalbh.wordpress.com/2008/06/11/google-like-autocomplete-suggestions/&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.tizag.com/javascriptT/javascript-string-replace.php"&gt;http://www.tizag.com/javascriptT/javascript-string-replace.php&lt;/a&gt;&lt;br /&gt;&lt;a href="http://techron.blogspot.com/2008/04/reading-textbox-or-other-control-values.html"&gt;http://techron.blogspot.com/2008/04/reading-textbox-or-other-control-values.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-8350647057738638849?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/8350647057738638849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=8350647057738638849' title='16 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8350647057738638849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8350647057738638849'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/12/using-autocomplete-ajax-control-with.html' title='Using AutoComplete Ajax Control With Separate ID Field from Name Field'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>16</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-3223317843222970700</id><published>2008-12-17T11:07:00.000-08:00</published><updated>2008-12-17T11:15:52.491-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='C# AutoComplete'/><title type='text'>Using LIKE in SQL</title><content type='html'>Be careful in the order of parameters while using LIKE in T-SQL. The following stored procedure did not work @Prefix LIKE dbo.aspnet_Stocks.Name. It must be reversed:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;set&lt;/span&gt; ANSI_NULLS &lt;span class="kwrd"&gt;ON&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;set&lt;/span&gt; QUOTED_IDENTIFIER &lt;span class="kwrd"&gt;ON&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;GO&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;ALTER&lt;/span&gt; &lt;span class="kwrd"&gt;PROCEDURE&lt;/span&gt; [dbo].[sproc_aspnet_GetStocksByPrefix]&lt;br /&gt;    @&lt;span class="kwrd"&gt;Prefix&lt;/span&gt; &lt;span class="kwrd"&gt;as&lt;/span&gt; &lt;span class="kwrd"&gt;varchar&lt;/span&gt;(50)=&lt;span class="kwrd"&gt;NULL&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;AS&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;BEGIN&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;SELECT&lt;/span&gt; *&lt;br /&gt;            &lt;span class="kwrd"&gt;FROM&lt;/span&gt; dbo.aspnet_Stocks&lt;br /&gt;            &lt;span class="kwrd"&gt;WHERE&lt;/span&gt; ((Symbol &lt;span class="kwrd"&gt;LIKE&lt;/span&gt; @&lt;span class="kwrd"&gt;Prefix&lt;/span&gt;) &lt;span class="kwrd"&gt;OR&lt;/span&gt; ( [Name]&lt;span class="kwrd"&gt;LIKE&lt;/span&gt; @&lt;span class="kwrd"&gt;Prefix&lt;/span&gt;))&lt;br /&gt;            &lt;span class="kwrd"&gt;RETURN&lt;/span&gt; 0    &lt;br /&gt;END&lt;/pre&gt;&lt;br /&gt;This was used in an AutoComplete AJAX control. The following reference describes the setup.&lt;br /&gt;&lt;br /&gt;Reference: &lt;a href="http://www.aspdotnetcodes.com/AutoComplete_From_Database.aspx"&gt;http://www.aspdotnetcodes.com/AutoComplete_From_Database.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A more efficient stored procedure would use a FullText Catalog indexed on a Text Column as described here: &lt;a href="http://support.microsoft.com/?kbid=916784"&gt;http://support.microsoft.com/?kbid=916784&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-3223317843222970700?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/3223317843222970700/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=3223317843222970700' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3223317843222970700'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3223317843222970700'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/12/using-like-in-sql.html' title='Using LIKE in SQL'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-762920352399073927</id><published>2008-12-16T23:37:00.000-08:00</published><updated>2008-12-16T23:45:49.677-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# GridView'/><category scheme='http://www.blogger.com/atom/ns#' term='C# sorting'/><title type='text'>Sorting a GridView</title><content type='html'>Sorting a GridView with a DataSource requires an external storage variable for a the last SortDirection. First, I call the GridViewReport_Sorting in the &lt;strong&gt;Sorting &lt;/strong&gt;event in the GridView. A GridView has e.SortExpression and e.SortDirection. I combine the two to form a unique Session variable and then set the SortDirection to compare at later sorts:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; GridViewReport_Sorting(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, GridViewSortEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        DataTable dt;&lt;br /&gt;        DataView dv;&lt;br /&gt;        dt = (DataTable)Cache[&lt;span class="str"&gt;"dvStocks"&lt;/span&gt;];&lt;br /&gt;        dv = &lt;span class="kwrd"&gt;new&lt;/span&gt; DataView(dt);&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; direction = SortDirection.Descending.ToString();&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; curDirecton = SortDirection.Ascending.ToString(); &lt;span class="rem"&gt;// set to default&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; key = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Concat(e.SortExpression, e.SortDirection);&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt;(Session[key]!=&lt;span class="kwrd"&gt;null&lt;/span&gt;) {&lt;br /&gt;            curDirecton = (&lt;span class="kwrd"&gt;string&lt;/span&gt;)Session[key];&lt;br /&gt;        }&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (curDirecton.Contains(&lt;span class="str"&gt;"Ascending"&lt;/span&gt;))&lt;br /&gt;        {&lt;br /&gt;            direction = Global.DESC; &lt;span class="rem"&gt;//DESC&lt;/span&gt;&lt;br /&gt;            Session[key] = SortDirection.Descending.ToString();&lt;br /&gt;        }&lt;br /&gt;        &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            direction = Global.ASC; &lt;span class="rem"&gt;//ASC&lt;/span&gt;&lt;br /&gt;            Session[key] = SortDirection.Ascending.ToString();&lt;br /&gt;        }&lt;br /&gt;        dv.Sort = e.SortExpression + &lt;span class="str"&gt;" "&lt;/span&gt; + direction;&lt;br /&gt;        Cache[&lt;span class="str"&gt;"dtCalculated"&lt;/span&gt;] = dv.ToTable();&lt;br /&gt;        GridViewReport.DataSource = dv;&lt;br /&gt;        GridViewReport.DataBind();&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;Reference: &lt;a href="http://forums.asp.net/t/825118.aspx"&gt;http://forums.asp.net/t/825118.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-762920352399073927?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/762920352399073927/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=762920352399073927' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/762920352399073927'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/762920352399073927'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/12/sorting-gridview.html' title='Sorting a GridView'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-1410647842790591222</id><published>2008-12-15T15:42:00.000-08:00</published><updated>2008-12-15T16:05:50.827-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# statements'/><category scheme='http://www.blogger.com/atom/ns#' term='C# global access'/><title type='text'>Using static strings and objects to increase performance and maintainence</title><content type='html'>I found this global variable article below to help me with using static strings and objects to increase performance and maintainence.&lt;br /&gt;&lt;br /&gt;For example, suppose I have an error message, "Error: ", that I might want to change to "There was a problem: ". Instead of search and replace n times, I could just use a static string variable to change the string value.&lt;br /&gt;&lt;br /&gt;Sample Global class:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;/// Summary description for Global&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Global&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; CSS_HIDDEN&lt;br /&gt;    {&lt;br /&gt;        get { &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="str"&gt;"hidden"&lt;/span&gt;; }&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; CSS_EMPTY&lt;br /&gt;    {&lt;br /&gt;        get { &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt;.Empty; }&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; CSS_CONTENT&lt;br /&gt;    {&lt;br /&gt;        get { &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="str"&gt;"content1"&lt;/span&gt;; }&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; ERROR_HEADER_HTML&lt;br /&gt;    {&lt;br /&gt;        get { &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="str"&gt;"&amp;lt;red&amp;gt;There was a problem:&amp;lt;/red&amp;gt;&amp;lt;/br&amp;gt;"&lt;/span&gt;; }&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; ERROR_HEADER&lt;br /&gt;    {&lt;br /&gt;        get { &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="str"&gt;"There was a problem:"&lt;/span&gt;; }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;Then one just accesses it with Global.ERROR_HEADER. Notice that there is no declarative instantiation for the static class.&lt;br /&gt;&lt;br /&gt;Reference: &lt;a href="http://dotnetperls.com/Content/Global-Variables-ASPNET.aspx"&gt;http://dotnetperls.com/Content/Global-Variables-ASPNET.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-1410647842790591222?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/1410647842790591222/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=1410647842790591222' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1410647842790591222'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1410647842790591222'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/12/using-static-strings-and-objects-to.html' title='Using static strings and objects to increase performance and maintainence'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-3010186653835855022</id><published>2008-12-14T14:37:00.000-08:00</published><updated>2008-12-15T11:15:20.969-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# config'/><category scheme='http://www.blogger.com/atom/ns#' term='C# sitemap'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='C# securitytrimming'/><title type='text'>Use securitytrimming to limit role views of Menu and SiteMap</title><content type='html'>Use securitytrimming to limit role views of Menu and SiteMap.&lt;br /&gt;&lt;br /&gt;Modify the Web.config file's configuration tag with:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;system.web&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMap&lt;/span&gt; &lt;span class="attr"&gt;defaultProvider&lt;/span&gt;&lt;span class="kwrd"&gt;="secureProvider"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;providers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="secureProvider"&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="System.Web.Xml&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Provider"&lt;/span&gt;&lt;br /&gt;             &lt;span class="attr"&gt;siteMapFile&lt;/span&gt;&lt;span class="kwrd"&gt;="web.sitemap"&lt;/span&gt; &lt;span class="attr"&gt;securityTrimmingEnabled&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;providers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;siteMap&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;system.web&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;Then modify Web.sitemap to make sure roles parameter is set to * or admin. Notice how I explicitly set the nodes roles parameter in the links outside the website&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="html"&gt;xml&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;="1.0"&lt;/span&gt; &lt;span class="attr"&gt;encoding&lt;/span&gt;&lt;span class="kwrd"&gt;="utf-8"&lt;/span&gt; ?&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMap&lt;/span&gt; &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0"&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="SiteMap.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Site Map"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;="Site Map"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="Default.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Home"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;="Home"&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="Login.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Login/Logout"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;="Login or Logout"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="About.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="About"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;="About"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/Tools/Tools.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Tools"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/Tools/GrowthAnalysis.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Growth Analysis"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/Tools/FundamentalAnalysis.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Fundamental Analysis"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/Tools/PriceToSalesAnalysis.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Price To Sales Analysis"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/Tools/TechnicalAnalysis.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Technical Analysis"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/MyLists/MyLists.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="My Lists"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/MyLists/Management.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Management"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/MyLists/Tracker.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Tracker"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/MarketWatch/MarketWatch.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Market Watch"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/MarketWatch/MarketSummary.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Market Summary"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/MarketWatch/SectorSummary.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Sector Summary"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/MarketWatch/IntermarketSummary.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Inter-market Summary"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/MarketWatch/WorldMarketSummary.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="World Market Summary"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/Media.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Media"&lt;/span&gt; &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="http://www.bloomberg.com/news/av/"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Bloomberg Audio/Video"&lt;/span&gt; &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="http://www.thestreet.com/_tscnav/audio/taskaudio/index.html"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Real Story With Aaron Task"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="http://www.thestreet.com/_tscnav/video/index.html"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="TheStreet.com TV"&lt;/span&gt; &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="http://online.wsj.com/public/us"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Wall Street Journal"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="http://www.nytimes.com/pages/business/index.html"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="New York Times Business"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="http://markets.usatoday.com/custom/usatoday-com/html-markets.asp"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="USA Today Markets"&lt;/span&gt; &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="http://www.briefing.com/Investor/Public/MarketSnapshot/HeadlineHits.htm"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Briefing.com Headline Hits"&lt;/span&gt; &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="http://www.pbs.org/nbr/"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="PBS Nightly Business Report"&lt;/span&gt; &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="http://www.redoption.com/shadow_video.php"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="RedOption Shadow Trader Video"&lt;/span&gt; &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;="Weekend Update"&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/Commentary.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Commentary"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="http://stockmonger.blogspot.com/"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Stock Monger"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="http://find.thestreet.com/cgi-bin/texis/find/results.html?nh=20&amp;amp;amp;t=Cramer"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Jim Cramer"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="http://www.rightsideadvisors.com/advisors/default.aspx?"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Richard Suttmeier"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="http://articles.moneycentral.msn.com/Commentary/Experts/Jubak/Jim_Jubak.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Jim Jubak"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="http://bigpicture.typepad.com/"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="The Big Picture With Barry Ritholtz"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="*"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/Admin/Admin.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Admin"&lt;/span&gt; &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="Admin"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/Admin/UpdateAllStocks.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Update All Stocks"&lt;/span&gt; &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="Admin"&lt;/span&gt;  &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/Admin/StockScaffold.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Stock Scaffold"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="Admin"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/Admin/ManageRoles.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Manager User Roles"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="Admin"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="~/Admin/ManageLists.aspx"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Manage Lists"&lt;/span&gt;  &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;roles&lt;/span&gt;&lt;span class="kwrd"&gt;="Admin"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;siteMapNode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;siteMap&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-3010186653835855022?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/3010186653835855022/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=3010186653835855022' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3010186653835855022'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3010186653835855022'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/12/use-securitytrimming-to-limit-role.html' title='Use securitytrimming to limit role views of Menu and SiteMap'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-1142801570563603090</id><published>2008-07-25T14:55:00.000-07:00</published><updated>2008-07-25T16:17:55.119-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='subversion'/><category scheme='http://www.blogger.com/atom/ns#' term='SVN'/><title type='text'>Beginning Subversion (SVN) for .NET</title><content type='html'>I've had enough of zipping my project for backup before editing it. I mean it works fine for personal development, but for team projects it is time for a versioning system. That means either using CVS (Control Versioning System) or SVN (Subversion), since VSS (Visual Source Safe) would be too expensive. &lt;br /&gt;&lt;br /&gt;First you need the download and install subversion: &lt;a href="http://subversion.tigris.org/"&gt;http://subversion.tigris.org/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Next you need to create the repository. Suppose you've created your svn directory. Fire up the command prompt and navigate there. create the "MyProject" repository:&lt;br /&gt;svnadmin create MyProject&lt;br /&gt;&lt;br /&gt;Next, recognize the recommended standard structures:&lt;br /&gt;svn/MyProject&lt;br /&gt;svn/MyProject/trunk&lt;br /&gt;svn/MyProject/branches&lt;br /&gt;svn/MyProject/tags&lt;br /&gt;&lt;br /&gt;Next, place the trunk directory in hte MyProject directory and the .NET actual Website directory in the trunk:&lt;br /&gt;svn/MyProject/trunk/MyWebsite&lt;br /&gt;&lt;br /&gt;Next, checkout the project:&lt;br /&gt;svn checkout "file:///c:/documents and settings/user/svn/MyProject"&lt;br /&gt;&lt;br /&gt;Next, add the trunk, branches, and tags folders to the MyProject repository:&lt;br /&gt;cd MyProject&lt;br /&gt;svn mkdir trunk&lt;br /&gt;svn mkdir branches&lt;br /&gt;svn update&lt;br /&gt;svn add tags&lt;br /&gt;&lt;br /&gt;Next, commit the updates to in effect check-in the project:&lt;br /&gt;svn commit -m "initial project setup"&lt;br /&gt;&lt;br /&gt;References:&lt;br /&gt;&lt;a href="http://www.germane-software.com/~ser/R_n_R/subversion.html"&gt;http://www.germane-software.com/~ser/R_n_R/subversion.html&lt;/a&gt;&lt;br /&gt;&lt;a href="http://www.onlamp.com/pub/a/bsd/2005/08/11/FreeBSD_Basics.html?page=2"&gt;http://www.onlamp.com/pub/a/bsd/2005/08/11/FreeBSD_Basics.html?page=2&lt;/a&gt;&lt;br /&gt;&lt;a href="http://svnbook.red-bean.com/"&gt;http://svnbook.red-bean.com/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-1142801570563603090?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/1142801570563603090/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=1142801570563603090' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1142801570563603090'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1142801570563603090'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/07/beginning-subversion-svn-for-net.html' title='Beginning Subversion (SVN) for .NET'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-27181319768239328</id><published>2008-07-19T13:45:00.000-07:00</published><updated>2008-07-19T13:49:41.326-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='naming conventions'/><title type='text'>Opposite Conventions List</title><content type='html'>Here is a list of opposing actions to help maintain consistent conventions:&lt;br /&gt;add/remove &lt;br /&gt;increment/decrement &lt;br /&gt;open/close &lt;br /&gt;begin/end &lt;br /&gt;insert/delete &lt;br /&gt;show/hide &lt;br /&gt;create/destroy &lt;br /&gt;lock/unlock &lt;br /&gt;source/target &lt;br /&gt;first/last &lt;br /&gt;min/max &lt;br /&gt;start/stop &lt;br /&gt;get/put &lt;br /&gt;next/previous &lt;br /&gt;up/down &lt;br /&gt;get/set &lt;br /&gt;old/new   &lt;br /&gt;Reference: &lt;a href="http://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670/ref=pd_bbs_sr_1?ie=UTF8&amp;s=books&amp;qid=1216500491&amp;sr=8-1"&gt;Code Complete&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-27181319768239328?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/27181319768239328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=27181319768239328' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/27181319768239328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/27181319768239328'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/07/opposite-conventions-list.html' title='Opposite Conventions List'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-2349100854902330251</id><published>2008-07-12T16:16:00.000-07:00</published><updated>2008-07-12T23:47:28.264-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DokuWiki'/><category scheme='http://www.blogger.com/atom/ns#' term='wiki'/><category scheme='http://www.blogger.com/atom/ns#' term='FlexWiki'/><category scheme='http://www.blogger.com/atom/ns#' term='software design'/><title type='text'>Wiki Trials and Errors</title><content type='html'>I read about Wikis in Code Complete and decided to try some out for software design.  This was my first contact beyond the famous Wikipedia. Wikis are basically editable html pages for documenting facts, design, and collaborating amongst users. Here are the results:&lt;br /&gt;&lt;br /&gt;I tried FlexWiki and read their basic documentation to add namespaces and edit pages.  I set it up on my localhost and continuously ran into 404 errors after updating a page. The few fixes I read about looked incomplete, so I scrapped the FlexWiki.&lt;br /&gt;&lt;br /&gt;Next I installed DokuWiki from a PHP application on my Kensoft server.  I'll update the review when I'm done setting up a sample. But in the meantime, I'd recommend avoiding FlexWiki.&lt;br /&gt;&lt;br /&gt;Reference: &lt;a href="http://www.splitbrain.org/go/dokuwiki"&gt;http://www.splitbrain.org/go/dokuwiki&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-2349100854902330251?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/2349100854902330251/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=2349100854902330251' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2349100854902330251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2349100854902330251'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/07/wiki-trials-and-errors.html' title='Wiki Trials and Errors'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-1924255774078700456</id><published>2008-07-03T01:51:00.000-07:00</published><updated>2008-07-03T01:58:04.845-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Update'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Delete'/><category scheme='http://www.blogger.com/atom/ns#' term='C# GridView'/><title type='text'>Using a GridView with Edit and Delete that use stored procedures</title><content type='html'>Here is how to use a GridView with Edit and Delete that use stored procedures for update and delete. First, the aspx:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="gvEmail"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;AutoGenerateDeleteButton&lt;/span&gt;&lt;span class="kwrd"&gt;="True"&lt;/span&gt; &lt;br /&gt;        &lt;span class="attr"&gt;AutoGenerateEditButton&lt;/span&gt;&lt;span class="kwrd"&gt;="True"&lt;/span&gt; &lt;span class="attr"&gt;AutoGenerateColumns&lt;/span&gt;&lt;span class="kwrd"&gt;="False"&lt;/span&gt; &lt;span class="attr"&gt;DataSourceID&lt;/span&gt;&lt;span class="kwrd"&gt;="SqlDataSource1"&lt;/span&gt;&lt;br /&gt;        &lt;span class="attr"&gt;AllowPaging&lt;/span&gt;&lt;span class="kwrd"&gt;="True"&lt;/span&gt; &lt;span class="attr"&gt;OnRowDeleting&lt;/span&gt;&lt;span class="kwrd"&gt;="gvEmail_RowDeleting"&lt;/span&gt; &lt;span class="attr"&gt;PageSize&lt;/span&gt;&lt;span class="kwrd"&gt;="99"&lt;/span&gt; &lt;span class="attr"&gt;OnRowUpdating&lt;/span&gt;&lt;span class="kwrd"&gt;="gvEmail_OnRowUpdating"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Columns&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:BoundField&lt;/span&gt; &lt;span class="attr"&gt;DataField&lt;/span&gt;&lt;span class="kwrd"&gt;="email"&lt;/span&gt; &lt;span class="attr"&gt;HeaderText&lt;/span&gt;&lt;span class="kwrd"&gt;="email"&lt;/span&gt; &lt;span class="attr"&gt;SortExpression&lt;/span&gt;&lt;span class="kwrd"&gt;="email"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Columns&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:SqlDataSource&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="SqlDataSource1"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;ConnectionString&lt;/span&gt;&lt;span class="kwrd"&gt;="&amp;lt;%$ ConnectionStrings:ConnectionString %&amp;gt;"&lt;/span&gt;&lt;br /&gt;            &lt;span class="attr"&gt;SelectCommand&lt;/span&gt;&lt;span class="kwrd"&gt;="SELECT [email] FROM [vw_Email]"&lt;/span&gt;&lt;br /&gt;            &lt;span class="attr"&gt;DeleteCommand&lt;/span&gt;&lt;span class="kwrd"&gt;="sproc_DeleteEmail"&lt;/span&gt; &lt;span class="attr"&gt;DeleteCommandType&lt;/span&gt;&lt;span class="kwrd"&gt;="StoredProcedure"&lt;/span&gt;&lt;br /&gt;            &lt;span class="attr"&gt;UpdateCommand&lt;/span&gt;&lt;span class="kwrd"&gt;="sproc_UpdateEmail"&lt;/span&gt; &lt;span class="attr"&gt;UpdateCommandType&lt;/span&gt;&lt;span class="kwrd"&gt;="StoredProcedure"&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;DeleteParameters&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:Parameter&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;="email"&lt;/span&gt; &lt;span class="attr"&gt;Type&lt;/span&gt;&lt;span class="kwrd"&gt;="String"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;DeleteParameters&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;UpdateParameters&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:Parameter&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;="email"&lt;/span&gt; &lt;span class="attr"&gt;Type&lt;/span&gt;&lt;span class="kwrd"&gt;="String"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:Parameter&lt;/span&gt; &lt;span class="attr"&gt;Name&lt;/span&gt;&lt;span class="kwrd"&gt;="newEmail"&lt;/span&gt; &lt;span class="attr"&gt;Type&lt;/span&gt;&lt;span class="kwrd"&gt;="String"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;UpdateParameters&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:SqlDataSource&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;Now the code behind.&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; gvEmail_RowDeleting(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, GridViewDeleteEventArgs e) &lt;span class="rem"&gt;//DELETE&lt;/span&gt;&lt;br /&gt;    {&lt;br /&gt;        SqlConnection conn = &lt;span class="kwrd"&gt;new&lt;/span&gt; SqlConnection(SqlDataSource1.ConnectionString);&lt;br /&gt;        System.Data.SqlClient.SqlCommand command = &lt;span class="kwrd"&gt;new&lt;/span&gt; System.Data.SqlClient.SqlCommand(&lt;span class="str"&gt;"sproc_DeleteEmail"&lt;/span&gt;, conn);&lt;br /&gt;        command.CommandType = System.Data.CommandType.StoredProcedure;&lt;br /&gt;        conn.Open();&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; email = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Empty;&lt;br /&gt;        DataControlFieldCell cell = gvEmail.Rows[e.RowIndex].Cells[1] &lt;span class="kwrd"&gt;as&lt;/span&gt; DataControlFieldCell;&lt;br /&gt;        gvEmail.Columns[0].ExtractValuesFromCell(&lt;br /&gt;            e.Keys,&lt;br /&gt;            cell,&lt;br /&gt;            DataControlRowState.Normal,&lt;br /&gt;            &lt;span class="kwrd"&gt;true&lt;/span&gt;);&lt;br /&gt;        email = e.Keys[0].ToString();&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (!&lt;span class="kwrd"&gt;string&lt;/span&gt;.IsNullOrEmpty(email))&lt;br /&gt;        {&lt;br /&gt;            command.Parameters.AddWithValue(&lt;span class="str"&gt;"@email"&lt;/span&gt;, email);&lt;br /&gt;            command.ExecuteNonQuery();&lt;br /&gt;        }&lt;br /&gt;        command.Parameters.Clear();&lt;br /&gt;        conn.Close();&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; gvEmail_OnRowUpdating(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, GridViewUpdateEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        SqlConnection conn = &lt;span class="kwrd"&gt;new&lt;/span&gt; SqlConnection(SqlDataSource1.ConnectionString);&lt;br /&gt;        System.Data.SqlClient.SqlCommand command = &lt;span class="kwrd"&gt;new&lt;/span&gt; System.Data.SqlClient.SqlCommand(&lt;span class="str"&gt;"sproc_UpdateEmail"&lt;/span&gt;, conn);&lt;br /&gt;        command.CommandType = System.Data.CommandType.StoredProcedure;&lt;br /&gt;        conn.Open();&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; newEmail = e.NewValues[0] &lt;span class="kwrd"&gt;as&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt;;&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; email = e.OldValues[0] &lt;span class="kwrd"&gt;as&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt;;&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (!&lt;span class="kwrd"&gt;string&lt;/span&gt;.IsNullOrEmpty(email))&lt;br /&gt;        {&lt;br /&gt;            command.Parameters.AddWithValue(&lt;span class="str"&gt;"@email"&lt;/span&gt;, email);&lt;br /&gt;            command.Parameters.AddWithValue(&lt;span class="str"&gt;"@newEmail"&lt;/span&gt;, newEmail);&lt;br /&gt;            command.ExecuteNonQuery();&lt;br /&gt;        }&lt;br /&gt;        command.Parameters.Clear();&lt;br /&gt;        conn.Close();&lt;br /&gt;    }   &lt;/pre&gt;Note: Exception handling left off for brevity.&lt;br/&gt; Reference: &lt;a href="http://www.developerfusion.co.uk/show/91/7/"&gt;http://www.developerfusion.co.uk/show/91/7/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-1924255774078700456?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/1924255774078700456/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=1924255774078700456' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1924255774078700456'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1924255774078700456'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/07/using-gridview-with-edit-and-delete.html' title='Using a GridView with Edit and Delete that use stored procedures'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-6955642393297857651</id><published>2008-07-01T15:43:00.000-07:00</published><updated>2008-07-01T16:03:08.236-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# XML XPath'/><category scheme='http://www.blogger.com/atom/ns#' term='C# GridView'/><title type='text'>Using XML and XPath for a GridView</title><content type='html'>This demonstrates how to use XML and XPath with a GridView to display links:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="gvLinks"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;DataSourceID&lt;/span&gt;&lt;span class="kwrd"&gt;="XmlDataSource1"&lt;/span&gt; &lt;span class="attr"&gt;AutoGenerateColumns&lt;/span&gt;&lt;span class="kwrd"&gt;="False"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Columns&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:TemplateField&lt;/span&gt; &lt;span class="attr"&gt;HeaderText&lt;/span&gt;&lt;span class="kwrd"&gt;="Link"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;    &lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:HyperLink&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="HyperLink1"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;Target&lt;/span&gt;&lt;span class="kwrd"&gt;="_blank"&lt;/span&gt; &lt;span class="attr"&gt;NavigateUrl&lt;/span&gt;&lt;span class="kwrd"&gt;='&amp;lt;%#XPath("href") %&amp;gt;'&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span class="asp"&gt;&amp;lt;%&lt;/span&gt;#XPath(&lt;span class="str"&gt;"title"&lt;/span&gt;)&lt;span class="asp"&gt;%&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:HyperLink&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;    &lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:TemplateField&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:TemplateField&lt;/span&gt; &lt;span class="attr"&gt;HeaderText&lt;/span&gt;&lt;span class="kwrd"&gt;="Description"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:Label&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="lblrOwner"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;Text&lt;/span&gt;=&amp;&lt;span class="attr"&gt;lt&lt;/span&gt;;%#&lt;span class="attr"&gt;XPath&lt;/span&gt;(&lt;span class="kwrd"&gt;"description"&lt;/span&gt;)%&amp;&lt;span class="attr"&gt;gt&lt;/span&gt;;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:Label&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:TemplateField&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Columns&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:XmlDataSource&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="XmlDataSource1"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;DataFile&lt;/span&gt;&lt;span class="kwrd"&gt;="~/App_Data/Links.xml"&lt;/span&gt;&lt;br /&gt;        &lt;span class="attr"&gt;XPath&lt;/span&gt;&lt;span class="kwrd"&gt;="links/link"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:XmlDataSource&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;Here is the XML file:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="html"&gt;xml&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;="1.0"&lt;/span&gt; &lt;span class="attr"&gt;encoding&lt;/span&gt;&lt;span class="kwrd"&gt;="utf-8"&lt;/span&gt; ?&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;links&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;link&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Yahoo&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;http://www.yahoo.com/&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;owner&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Yang&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;owner&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Yahoo web portal&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;link&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;link&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;MSN&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;http://www.msn.com/&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;owner&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Balmer&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;owner&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Microsoft web portal&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;link&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;link&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Delicious&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;http://del.icio.us/&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;owner&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;owner&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Internet bookmark manager&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;link&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;link&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;YouTube&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;http://youtube.com/&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;owner&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;owner&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Internet videos&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;link&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;link&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;SlashDot&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;http://slashdot.org/&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;owner&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;owner&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;News that matters&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;link&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;  &lt;br /&gt;  &lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;links&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;Reference: &lt;a href="http://bytes.com/forum/thread528704.html"&gt;http://bytes.com/forum/thread528704.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-6955642393297857651?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/6955642393297857651/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=6955642393297857651' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6955642393297857651'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6955642393297857651'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/07/using-xml-and-xpath-for-gridview.html' title='Using XML and XPath for a GridView'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-3043677243667464160</id><published>2008-06-23T16:33:00.000-07:00</published><updated>2008-06-23T16:37:47.664-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# File I/O'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Opening, Reading, and Writing a file</title><content type='html'>Here is an example of Opening/Reading a file in btnOpen_Click and Writing in btnSave_Click:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; btnOpen_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt;.IsNullOrEmpty(txtFileName.Text)) txtFileName.Text=&lt;span class="str"&gt;"c:/temp/temp.txt"&lt;/span&gt;;&lt;br /&gt;        StreamReader sr = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;br /&gt;        &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            sr = &lt;span class="kwrd"&gt;new&lt;/span&gt; StreamReader(txtFileName.Text);&lt;br /&gt;            txtFileContent.Text = sr.ReadToEnd();&lt;br /&gt;            sr.Close();&lt;br /&gt;            displayMessage(&lt;span class="str"&gt;"Successfully opened file"&lt;/span&gt;);&lt;br /&gt;        }&lt;br /&gt;        &lt;span class="kwrd"&gt;catch&lt;/span&gt; (Exception ex)&lt;br /&gt;        {&lt;br /&gt;            displayMessage(ex.Message);&lt;br /&gt;        }&lt;br /&gt;        &lt;span class="kwrd"&gt;finally&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            sr.Close();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; btnSave_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt;.IsNullOrEmpty(txtFileName.Text)) txtFileName.Text = &lt;span class="str"&gt;"c:/temp/temp.txt"&lt;/span&gt;;&lt;br /&gt;        StreamWriter sw = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;br /&gt;        &lt;span class="kwrd"&gt;try&lt;/span&gt;{&lt;br /&gt;            sw = &lt;span class="kwrd"&gt;new&lt;/span&gt; StreamWriter(txtFileName.Text);&lt;br /&gt;            &lt;span class="kwrd"&gt;string&lt;/span&gt;[] ar;&lt;br /&gt;            ar = txtFileContent.Text.Split(Environment.NewLine.ToCharArray());&lt;br /&gt;            &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt; sIn &lt;span class="kwrd"&gt;in&lt;/span&gt; ar)&lt;br /&gt;            {&lt;br /&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt;(!&lt;span class="kwrd"&gt;string&lt;/span&gt;.IsNullOrEmpty(sIn))&lt;br /&gt;                    sw.Write(sIn.Trim()+Environment.NewLine);&lt;br /&gt;            }&lt;br /&gt;        }&lt;span class="kwrd"&gt;catch&lt;/span&gt; (Exception ex) &lt;br /&gt;        {&lt;br /&gt;            displayMessageLine(ex.Message);&lt;br /&gt;        }&lt;br /&gt;        &lt;span class="kwrd"&gt;finally&lt;/span&gt;{&lt;br /&gt;            sw.Close();&lt;br /&gt;        }&lt;br /&gt;    }&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-3043677243667464160?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/3043677243667464160/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=3043677243667464160' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3043677243667464160'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3043677243667464160'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/06/opening-reading-and-writing-file.html' title='Opening, Reading, and Writing a file'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-3588835955653812973</id><published>2008-06-21T15:16:00.000-07:00</published><updated>2008-06-22T01:25:04.758-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# bool'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Values'/><title type='text'>Using a nullable boolean.</title><content type='html'>It is possible to assign a nullable boolean in C#. The trick is to use ? in the declaration. Once declared, one can use the HasValue() method. An example follows:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Page_Load(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;bool&lt;/span&gt;? isUser = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;br /&gt;        lblStatus.Text = isUser.HasValue.ToString(); //displays false&lt;br /&gt;        // an int example: &lt;span class="kwrd"&gt;Nullable&lt;/span&gt;&lt;&lt;span class="kwrd"&gt;int&lt;/span&gt;&gt; i = null;&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; btnCheckStatus_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;bool&lt;/span&gt;? isUser = &lt;span class="kwrd"&gt;false&lt;/span&gt;;&lt;br /&gt;        lblStatus.Text = isUser.HasValue.ToString(); //displays true&lt;br /&gt;    }&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-3588835955653812973?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/3588835955653812973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=3588835955653812973' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3588835955653812973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3588835955653812973'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/06/using-nullable-boolean.html' title='Using a nullable boolean.'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-5085919908848491345</id><published>2008-06-05T10:22:00.000-07:00</published><updated>2008-06-05T10:42:44.948-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# GridView'/><title type='text'>Clearing controls in GridView row using delete</title><content type='html'>Here is how to clear controls in GridView row using delete. Be careful that GridViewDeleteEventArgs is not GridViewDeletedEventArgs! &lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;                                &amp;lt;asp:GridView ID=&lt;span class="str"&gt;"gvStolenStatusInfo"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; AutoGenerateColumns=&lt;span class="str"&gt;"false"&lt;/span&gt; AllowPaging=&lt;span class="str"&gt;"true"&lt;/span&gt;&lt;br /&gt;                                    EmptyDataText=&lt;span class="str"&gt;"No records found."&lt;/span&gt; PageSize=&lt;span class="str"&gt;"10"&lt;/span&gt; CssClass=&lt;span class="str"&gt;"gridView"&lt;/span&gt;&lt;br /&gt;                                    OnRowDeleting=&lt;span class="str"&gt;"gvStolenStatusInfo_RowDeleting"&lt;/span&gt; AutoGenerateDeleteButton=&lt;span class="str"&gt;"true"&lt;/span&gt;&amp;gt;&lt;br /&gt;                                    &amp;lt;Columns&amp;gt;&lt;br /&gt;                                        &amp;lt;asp:TemplateField HeaderText=&lt;span class="str"&gt;"Status"&lt;/span&gt;&amp;gt;&lt;br /&gt;                                            &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;                                                &amp;lt;asp:TextBox ID=&lt;span class="str"&gt;"txtuCode"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; Text=&lt;span class="str"&gt;'&amp;lt;%# Bind("Code") %&amp;gt;'&lt;/span&gt; /&amp;gt;&lt;br /&gt;                                            &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;                                        &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt;                                        &amp;lt;asp:TemplateField HeaderText=&lt;span class="str"&gt;"Comment"&lt;/span&gt;&amp;gt;&lt;br /&gt;                                            &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;                                                &amp;lt;asp:TextBox ID=&lt;span class="str"&gt;"txtuComment"&lt;/span&gt; runat=&lt;span class="str"&gt;"server"&lt;/span&gt; Text=&lt;span class="str"&gt;'&amp;lt;%# Bind("Comment") %&amp;gt;'&lt;/span&gt; /&amp;gt;&lt;br /&gt;                                            &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;                                        &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt;                                    &amp;lt;/Columns&amp;gt;&lt;br /&gt;                                &amp;lt;/asp:GridView&amp;gt; &lt;/pre&gt;Notice the OnRowDeleting set to x_RowDeleting function and AutoGenerateDeleteButton. Now for the delete function:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; gvStolenStatusInfo_RowDeleting(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, GridViewDeleteEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; rowID = e.RowIndex;&lt;br /&gt;        ((TextBox)gvStolenStatusInfo.Rows[rowID].FindControl(&lt;span class="str"&gt;"txtuCode"&lt;/span&gt;)).Text = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Empty;&lt;br /&gt;        ((TextBox)gvStolenStatusInfo.Rows[rowID].FindControl(&lt;span class="str"&gt;"txtuDate"&lt;/span&gt;)).Text = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Empty;&lt;br /&gt;    }&lt;/pre&gt;References: &lt;a href="http://www.codeproject.com/KB/webforms/Editable_GridView.aspx"&gt;http://www.codeproject.com/KB/webforms/Editable_GridView.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-5085919908848491345?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/5085919908848491345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=5085919908848491345' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5085919908848491345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5085919908848491345'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/06/clearing-controls-in-gridview-row-using.html' title='Clearing controls in GridView row using delete'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-3574316833687646394</id><published>2008-05-05T14:41:00.001-07:00</published><updated>2008-05-05T14:42:49.019-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# Multiple PostBack'/><category scheme='http://www.blogger.com/atom/ns#' term='C# SelectedIndexChanged'/><category scheme='http://www.blogger.com/atom/ns#' term='C# DataBinding'/><category scheme='http://www.blogger.com/atom/ns#' term='C# GridView'/><title type='text'>Multiple PostBack problem with GridView</title><content type='html'>I noticed my SelectedIndexChanged method being called twice in IE7 when I selected a gridview row.  I used solution 2 at &lt;a href="http://www.codeproject.com/KB/aspnet/GVImageCommandButtonProb.aspx"&gt;http://www.codeproject.com/KB/aspnet/GVImageCommandButtonProb.aspx&lt;/a&gt; to solve the problem.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-3574316833687646394?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/3574316833687646394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=3574316833687646394' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3574316833687646394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3574316833687646394'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/05/multiple-postback-problem-with-gridview.html' title='Multiple PostBack problem with GridView'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-706759971452487047</id><published>2008-05-05T13:09:00.001-07:00</published><updated>2008-05-05T13:12:42.585-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# StringBuilder'/><category scheme='http://www.blogger.com/atom/ns#' term='C# String'/><title type='text'>Resetting a StringBuilder</title><content type='html'>Here is how to reset a StringBuilder:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;myStringBuilder.Length = 0;&lt;/pre&gt;myStringBuilder.Remove(0, myStringBuilder.Length) also works, but why bother with that one?&lt;br /&gt;References: &lt;a href="http://forums.asp.net/t/1193708.aspx"&gt;http://forums.asp.net/t/1193708.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-706759971452487047?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/706759971452487047/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=706759971452487047' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/706759971452487047'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/706759971452487047'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/05/resetting-stringbuilder.html' title='Resetting a StringBuilder'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-8121104523764013363</id><published>2008-04-25T10:58:00.000-07:00</published><updated>2008-04-25T11:00:42.733-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='C# GUID'/><title type='text'>Creating a GUID from scatch</title><content type='html'>Sometimes you might want a psuedo-random string value. This can be done with:&lt;br /&gt;System.Guid.NewGuid().ToString();&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-8121104523764013363?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/8121104523764013363/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=8121104523764013363' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8121104523764013363'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8121104523764013363'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/04/creating-guid-from-scatch.html' title='Creating a GUID from scatch'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-9195401730498918184</id><published>2008-04-05T15:15:00.000-07:00</published><updated>2008-04-05T15:19:23.660-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# Configuration Mananger'/><category scheme='http://www.blogger.com/atom/ns#' term='C# LoginStatus'/><title type='text'>Changing the default login page for use with LoginStatus control</title><content type='html'>Sometimes it is desirable to have a different default login page.  For example, a simple site where administrators login at http://foo.com/admin/Login.aspx versus the standard http:foo.com/Login.aspx.  The LoginStatus control will hyperlink back to the default login page. To change this default login page, change the web.config file as follows:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;authentication&lt;/span&gt; &lt;span class="attr"&gt;mode&lt;/span&gt;&lt;span class="kwrd"&gt;="Forms"&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;forms&lt;/span&gt; &lt;span class="attr"&gt;loginUrl&lt;/span&gt;&lt;span class="kwrd"&gt;="~/admin/Login.aspx"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;forms&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;authentication&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;Reference: &lt;a href="http://erlend.oftedal.no/blog/?blogid=55"&gt;http://erlend.oftedal.no/blog/?blogid=55&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-9195401730498918184?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/9195401730498918184/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=9195401730498918184' title='240 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/9195401730498918184'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/9195401730498918184'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/04/changing-default-login-page-for-use.html' title='Changing the default login page for use with LoginStatus control'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>240</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-7389079039922906446</id><published>2008-04-02T17:17:00.000-07:00</published><updated>2008-04-02T17:18:39.065-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# javascript'/><title type='text'>How to trim a string in javascript</title><content type='html'>How to trim a string in javascript:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;var trimmed = str.replace(/^\s+|\s+$/g, &lt;span class="str"&gt;''&lt;/span&gt;) ;&lt;/pre&gt; Reference: &lt;a href="http://www.nicknettleton.com/zine/javascript/trim-a-string-in-javascript"&gt;http://www.nicknettleton.com/zine/javascript/trim-a-string-in-javascript&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-7389079039922906446?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/7389079039922906446/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=7389079039922906446' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/7389079039922906446'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/7389079039922906446'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/04/how-to-trim-string-in-javascript.html' title='How to trim a string in javascript'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-8883940987684067786</id><published>2008-04-02T13:00:00.000-07:00</published><updated>2008-04-02T14:10:58.393-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='C# javascript'/><title type='text'>Reading TextBox or other Control values with javascript</title><content type='html'>Reading TextBox or other Control values with javascript.&lt;br /&gt;Assume TextBox ID="txtName"&lt;br /&gt;First, there are the simple examples of a standard aspx page:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="text/javascript"&lt;/span&gt; &lt;span class="attr"&gt;languague&lt;/span&gt;&lt;span class="kwrd"&gt;="javascript"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;function&lt;/span&gt; simple1() {&lt;br /&gt;      &lt;span class="kwrd"&gt;var&lt;/span&gt; txtVal = $get(&lt;span class="str"&gt;'&amp;lt;%= txtName.ClientID %&amp;gt;'&lt;/span&gt;).value;&lt;br /&gt;   }&lt;br /&gt;   &lt;span class="kwrd"&gt;function&lt;/span&gt; simple2() {&lt;br /&gt;      &lt;span class="kwrd"&gt;var&lt;/span&gt; txtVal = $document.getElementById(&lt;span class="str"&gt;'&amp;lt;%= txtName.ClientID %&amp;gt;'&lt;/span&gt;).value;&lt;br /&gt;   }&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;Here is the complex sample used for accessing a MasterPage's updatePanel for example:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="rem"&gt;// In the ASPX class&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; scriptKey = &lt;span class="str"&gt;"alertName"&lt;/span&gt;;&lt;br /&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; script = &lt;span class="str"&gt;"function alertName() { var txt = document.getElementById('[txtNameID]'); alert(txt.value); }"&lt;/span&gt;; &lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;// In the Page_Load event&lt;/span&gt;&lt;br /&gt;script = script.Replace(&lt;span class="str"&gt;"[txtNameID]"&lt;/span&gt;, txtName.ClientID);&lt;br /&gt;ClientScript.RegisterClientScriptBlock(&lt;span class="kwrd"&gt;this&lt;/span&gt;.Page.GetType(), scriptKey, script, &lt;span class="kwrd"&gt;true&lt;/span&gt;); &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;references: &lt;a href="http://www.velocityreviews.com/forums/t109803-callback-manager-masterpage.html"&gt;http://www.velocityreviews.com/forums/t109803-callback-manager-masterpage.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-8883940987684067786?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/8883940987684067786/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=8883940987684067786' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8883940987684067786'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8883940987684067786'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/04/reading-textbox-or-other-control-values.html' title='Reading TextBox or other Control values with javascript'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-1265647764608596960</id><published>2008-03-28T14:46:00.000-07:00</published><updated>2008-03-28T14:48:40.874-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# static'/><category scheme='http://www.blogger.com/atom/ns#' term='C# const'/><title type='text'>const and static declarations</title><content type='html'>const and static declarations cannot be declared together because they are always together when marked const.&lt;br /&gt;Reference: &lt;a href="http://blogs.msdn.com/csharpfaq/archive/2004/03/12/88416.aspx"&gt;http://blogs.msdn.com/csharpfaq/archive/2004/03/12/88416.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-1265647764608596960?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/1265647764608596960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=1265647764608596960' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1265647764608596960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1265647764608596960'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/03/const-and-static-declarations.html' title='const and static declarations'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-1689151492494294882</id><published>2008-03-27T10:54:00.000-07:00</published><updated>2008-03-27T10:57:21.760-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# Wait'/><category scheme='http://www.blogger.com/atom/ns#' term='C# System.Threading'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Sleep'/><title type='text'>Simulating a time spanned event with the sleep event</title><content type='html'>Here is how to simulate a time spanned event with the sleep event and a millisecond argument:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;System.Threading.Thread.Sleep(2000);&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-1689151492494294882?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/1689151492494294882/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=1689151492494294882' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1689151492494294882'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1689151492494294882'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/03/simulating-time-spanned-event-with.html' title='Simulating a time spanned event with the sleep event'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-6773183231102016430</id><published>2008-03-27T08:40:00.000-07:00</published><updated>2008-03-27T08:49:21.033-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Configuration Mananger'/><title type='text'>Configure SQL Database for User Login</title><content type='html'>If you try and set up User Login without configuring the web.config file and try to login from a hosted site you might get an error similar to :" An attempt to attach an auto-named database for file C:\Documents and Settings\Administrator\My Documents\Visual Studio 2005\WebSites\WebSite1\App_Data\aspnetdb.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. "  &lt;br /&gt;To configure it for User Login, I first added the user database to the SQL server using this &lt;a href="http://techron.blogspot.com/2007/09/copying-mdf-sqlexpress-database-file-to.html"&gt;method&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Next, I changed the web.config file to include: &lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;connectionStrings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="ConnectionString"&lt;/span&gt; &lt;span class="attr"&gt;connectionString&lt;/span&gt;&lt;span class="kwrd"&gt;="Data Source=my.host.net;Database=myDatabase;uid=myUserId;pwd=myPassword"&lt;/span&gt; &lt;span class="attr"&gt;providerName&lt;/span&gt;&lt;span class="kwrd"&gt;="System.Data.SqlClient"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;connectionStrings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;system.web&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;authentication&lt;/span&gt; &lt;span class="attr"&gt;mode&lt;/span&gt;&lt;span class="kwrd"&gt;="Forms"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;membership&lt;/span&gt; &lt;span class="attr"&gt;defaultProvider&lt;/span&gt;&lt;span class="kwrd"&gt;="AspNetSqlMembershipProvider"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;providers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;clear&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="AspNetSqlMembershipProvider"&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="System.Web.Security.SqlMembershipProvider, System.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"&lt;/span&gt; &lt;span class="attr"&gt;connectionStringName&lt;/span&gt;&lt;span class="kwrd"&gt;="LocalSqlServersm"&lt;/span&gt; &lt;span class="attr"&gt;requiresQuestionAndAnswer&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt; &lt;span class="attr"&gt;requiresUniqueEmail&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt; &lt;span class="attr"&gt;passwordFormat&lt;/span&gt;&lt;span class="kwrd"&gt;="Hashed"&lt;/span&gt; &lt;span class="attr"&gt;minRequiredNonalphanumericCharacters&lt;/span&gt;&lt;span class="kwrd"&gt;="0"&lt;/span&gt; &lt;span class="attr"&gt;minRequiredPasswordLength&lt;/span&gt;&lt;span class="kwrd"&gt;="3"&lt;/span&gt; &lt;span class="attr"&gt;applicationName&lt;/span&gt;&lt;span class="kwrd"&gt;="/"&lt;/span&gt; &lt;span class="attr"&gt;enablePasswordRetrieval&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt; &lt;span class="attr"&gt;enablePasswordReset&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt; &lt;span class="attr"&gt;maxInvalidPasswordAttempts&lt;/span&gt;&lt;span class="kwrd"&gt;="3"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;providers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;membership&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;roleManager&lt;/span&gt; &lt;span class="attr"&gt;enabled&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;Just change the myX fields to your fields. And now your configuration manager should work to add users and roles.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-6773183231102016430?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/6773183231102016430/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=6773183231102016430' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6773183231102016430'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6773183231102016430'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/03/configure-sql-database-for-user-login.html' title='Configure SQL Database for User Login'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-2177669399491207288</id><published>2008-03-24T11:42:00.000-07:00</published><updated>2008-03-24T11:46:43.618-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# javascript'/><title type='text'>Running a client-side application using javascript in asp.net</title><content type='html'>Here is how to run a client-side application (.exe) using javascript in asp.net.  I don't recommend it, because you probably have to lower your IE security (Tools -&gt; Internet Options -&gt; Security... and allow unsafe activeX).&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt; &lt;span class="attr"&gt;language&lt;/span&gt;&lt;span class="kwrd"&gt;="javascript"&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="text/javascript"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;function&lt;/span&gt; btnSubmit_Click() {&lt;br /&gt;            &lt;span class="kwrd"&gt;var&lt;/span&gt; WshShell = &lt;span class="kwrd"&gt;new&lt;/span&gt; ActiveXObject(&lt;span class="str"&gt;"WScript.Shell"&lt;/span&gt;); &lt;br /&gt;            WshShell.Run(&lt;span class="str"&gt;"calc.exe"&lt;/span&gt;); &lt;br /&gt;        }&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:Button&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="btnSubmit"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;Text&lt;/span&gt;&lt;span class="kwrd"&gt;="Submit"&lt;/span&gt; &lt;span class="attr"&gt;OnClientClick&lt;/span&gt;&lt;span class="kwrd"&gt;="btnSubmit_Click();"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;reference: &lt;a href="http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_11275014.html"&gt;http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_11275014.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-2177669399491207288?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/2177669399491207288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=2177669399491207288' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2177669399491207288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2177669399491207288'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/03/running-client-side-application-using.html' title='Running a client-side application using javascript in asp.net'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-1859803896247111177</id><published>2008-03-20T21:44:00.000-07:00</published><updated>2008-03-20T21:47:10.504-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Web User Control'/><category scheme='http://www.blogger.com/atom/ns#' term='C# focus'/><title type='text'>Setting focus in a user control</title><content type='html'>Here is how to set focus in a user control. I used it in an update panel.&lt;br /&gt;&lt;br /&gt;ScriptManager.GetCurrent(this.Page).SetFocus(txtTarget);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-1859803896247111177?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/1859803896247111177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=1859803896247111177' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1859803896247111177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1859803896247111177'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/03/setting-focus-in-user-control.html' title='Setting focus in a user control'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-983068262396938672</id><published>2008-03-15T01:15:00.000-07:00</published><updated>2008-03-15T01:18:12.097-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server Management Studio Express'/><title type='text'>Giving Stored Procedure Permissions</title><content type='html'>To give the required permissions in SQL Server Management Express SQL 2005 database, go to Security -&gt; Schemas. Select the target schema. Right click for properties and Add the target user to the Execute Permission.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-983068262396938672?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/983068262396938672/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=983068262396938672' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/983068262396938672'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/983068262396938672'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/03/giving-stored-procedure-permissions.html' title='Giving Stored Procedure Permissions'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-3510201997612122331</id><published>2008-03-04T20:02:00.001-08:00</published><updated>2008-03-04T20:33:02.624-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='C# HTML'/><category scheme='http://www.blogger.com/atom/ns#' term='CSS'/><title type='text'>Prevent wrapping in table cell</title><content type='html'>Prevent wrapping in table cell. Since the old nowrap method is out of favor, the new method is to use:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;td&lt;/span&gt; &lt;span class="attr"&gt;style&lt;/span&gt;&lt;span class="kwrd"&gt;="white-space:nowrap"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; foo &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;td&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;reference: &lt;a href="http://www.thescripts.com/forum/thread468471.html"&gt;http://www.thescripts.com/forum/thread468471.html&lt;/a&gt;&lt;br /&gt;Note: this also works with a Calendar Extender and TextBox even if the cell is too short.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-3510201997612122331?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/3510201997612122331/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=3510201997612122331' title='22 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3510201997612122331'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3510201997612122331'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/03/prevent-wrapping-in-table-cell.html' title='Prevent wrapping in table cell'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>22</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-9195329661925952955</id><published>2008-03-02T22:42:00.000-08:00</published><updated>2008-03-02T22:46:58.328-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='email preview'/><category scheme='http://www.blogger.com/atom/ns#' term='HTML preview'/><category scheme='http://www.blogger.com/atom/ns#' term='C# javascript'/><title type='text'>Previewing a TextBox that has HTML with a Popup Window</title><content type='html'>Here is a nifty way to preview HTML in a TextBox. I use the ScriptManager and $get the TextBox ID before popping the window and then filling it.&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="text/javascript"&lt;/span&gt; &lt;span class="attr"&gt;language&lt;/span&gt;&lt;span class="kwrd"&gt;="javascript"&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;function&lt;/span&gt; preview() {&lt;br /&gt;            &lt;span class="kwrd"&gt;var&lt;/span&gt; txt= $get(&lt;span class="str"&gt;'txtContent'&lt;/span&gt;);&lt;br /&gt;            &lt;span class="kwrd"&gt;var&lt;/span&gt; sHTML= txt.value;&lt;br /&gt;            win = window.open(&lt;span class="str"&gt;", "&lt;/span&gt;, &lt;span class="str"&gt;'popup'&lt;/span&gt;, &lt;span class="str"&gt;'toolbar = no, status = no'&lt;/span&gt;);&lt;br /&gt;            win.document.write(&lt;span class="str"&gt;""&lt;/span&gt; + sHTML + &lt;span class="str"&gt;""&lt;/span&gt;);&lt;br /&gt;        }&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;Reference: &lt;a href="http://javascript.internet.com/forms/html-preview.html"&gt;http://javascript.internet.com/forms/html-preview.html&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-9195329661925952955?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/9195329661925952955/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=9195329661925952955' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/9195329661925952955'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/9195329661925952955'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/03/previewing-textbox-that-has-html-with.html' title='Previewing a TextBox that has HTML with a Popup Window'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-838310853792819434</id><published>2008-03-02T21:39:00.000-08:00</published><updated>2008-03-02T21:52:54.793-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server Management Studio Express'/><title type='text'>SQL Server Management Studio Express Review</title><content type='html'>SQL Server Management Studio Express is fine GUI for manipulating your database. Unfortunately, the problems I've been having are due to the complete lack of robustness. Try copying over 500 records to your table via the cut and paste Excel method and you should expect the program to freeze up and maybe have success. I would recommend using your own stored procedure (SPROC) for data uploading tasks. It is more cumbersome, but at least it works for large data handling.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-838310853792819434?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/838310853792819434/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=838310853792819434' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/838310853792819434'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/838310853792819434'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/03/sql-server-management-studio-express.html' title='SQL Server Management Studio Express Review'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-1292585693778898746</id><published>2008-03-02T19:49:00.000-08:00</published><updated>2008-03-02T19:51:41.449-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# Dynamic Control'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Casting'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Error'/><title type='text'>Unable to cast object of type Foo to object of type Foo</title><content type='html'>I would get the error: Unable to cast object of type Foo to object of type Foo in my dynamic control. I read some problems about that kind of error and it said to make sure the Control was set to null before the cast. No error afterwards, at least so far.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-1292585693778898746?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/1292585693778898746/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=1292585693778898746' title='45 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1292585693778898746'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1292585693778898746'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/03/unable-to-cast-object-of-type-foo-to.html' title='Unable to cast object of type Foo to object of type Foo'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>45</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-1519954031653481643</id><published>2008-03-02T17:46:00.000-08:00</published><updated>2008-03-02T18:05:21.661-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# HTML'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Mail'/><title type='text'>Setting up form for HTML Email and Avoiding HttpRequestValidationException</title><content type='html'>In a &lt;a href="http://techron.blogspot.com/2007/11/setup-email-form-for-net-20.html"&gt;previous post&lt;/a&gt; I showed you how to set up .NET for email. But what if I want to send it as HTML. I tried and received this error: System.Web.HttpRequestValidationException: A potentially dangerous Request.Form value was detected from the client ...&lt;br /&gt;&lt;br /&gt;The validation problem is solved by setting the Page attribute Validation="false". But then when I sent the HTML it was received as text. &lt;br /&gt;&lt;br /&gt;The solution is to use IsHTML=true In my example, I used a check box:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; btnSend_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; sTo = &lt;span class="str"&gt;"jane@foo.com"&lt;/span&gt;;&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; sFrom = ddlFrom.SelectedItem.Text.Trim();&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; sSubject = txtSubject.Text.Trim();&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; sBody = txtContent.Text.Trim();&lt;br /&gt;        lblStatus.Text = &lt;span class="str"&gt;"Sending... please wait"&lt;/span&gt;;&lt;br /&gt;        MailMessage msg = &lt;span class="kwrd"&gt;new&lt;/span&gt; MailMessage(sFrom, sTo, sSubject, sBody);&lt;br /&gt;        msg.IsBodyHtml = chkIsHTML.Checked;&lt;br /&gt;        SmtpClient mailObj = &lt;span class="kwrd"&gt;new&lt;/span&gt; SmtpClient(&lt;span class="str"&gt;"localHost"&lt;/span&gt;);&lt;br /&gt;        mailObj.Credentials = &lt;span class="kwrd"&gt;new&lt;/span&gt; NetworkCredential(&lt;span class="str"&gt;"username"&lt;/span&gt;, &lt;span class="str"&gt;"password"&lt;/span&gt;);&lt;br /&gt;        mailObj.Send(msg);&lt;br /&gt;        clearTexts();&lt;br /&gt;        lblStatus.Text = &lt;span class="str"&gt;"Success: Sent message to Jane at "&lt;/span&gt; + DateTime.Now.ToLongTimeString() + &lt;span class="str"&gt;" Eastern."&lt;/span&gt;;&lt;br /&gt;    &lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;References: &lt;a href="http://www.hintsandtips.com/ShowPost/131/hat.aspx"&gt;http://www.hintsandtips.com/ShowPost/131/hat.aspx&lt;/a&gt;&lt;br /&gt;&lt;a href="http://aspnet.4guysfromrolla.com/articles/080206-1.aspx"&gt;http://aspnet.4guysfromrolla.com/articles/080206-1.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-1519954031653481643?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/1519954031653481643/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=1519954031653481643' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1519954031653481643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1519954031653481643'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/03/setting-up-form-for-html-email-and.html' title='Setting up form for HTML Email and Avoiding HttpRequestValidationException'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-2048582026185809166</id><published>2008-02-27T23:58:00.000-08:00</published><updated>2008-02-28T00:17:27.370-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Delegate'/><category scheme='http://www.blogger.com/atom/ns#' term='lazy load panel'/><category scheme='http://www.blogger.com/atom/ns#' term='C# TabContainer'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Trigger'/><category scheme='http://www.blogger.com/atom/ns#' term='C# javascript'/><title type='text'>Lazy Load Panel Courtesy of TabContainer and UpdatePanel</title><content type='html'>Here is how I implemented a Lazy load Panel. This is a nifty way to have a mini-menu of tabs without some big data transfer happening all at once. The ASP.NET render after complete model makes incremental rendering a necessary task of the developer or else the users will take a hike. This is my adaptation of Matt Burseth's &lt;a href="http://mattberseth.com/blog/2007/07/how_to_lazyload_tabpanels_with.html"&gt; example &lt;/a&gt; that should be helpful to avoid the LESSTHAN%= and LESSTHAN%# problems that I had. Remember to put the js in the form tag (probably below the ScriptManager). Two parts below are the ASPX and Code Behind. ASPX:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;html&lt;/span&gt; &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;="http://www.w3.org/1999/xhtml"&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;head&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Lazy Load Panel Page&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;   &lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;head&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;form&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="form1"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ajax:ScriptManager&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="ScriptManager1"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ajax:ScriptManager&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="text/javascript"&lt;/span&gt; &lt;span class="attr"&gt;language&lt;/span&gt;&lt;span class="kwrd"&gt;="javascript"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;    &lt;span class="rem"&gt;//var _updateProgressDiv;&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;span class="kwrd"&gt;function&lt;/span&gt; pageLoad(sender, args) {&lt;br /&gt;        &lt;span class="rem"&gt;// register for our eveents&lt;/span&gt;&lt;br /&gt;        Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest);&lt;br /&gt;        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest);&lt;br /&gt;        &lt;br /&gt;        &lt;span class="rem"&gt;//_updateProgressDiv = $get('ActionProgress');&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="kwrd"&gt;function&lt;/span&gt; beginRequest(sender, args) {&lt;br /&gt;        &lt;span class="rem"&gt;// get the gridview element&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;var&lt;/span&gt; tabContainer = $get(&lt;span class="str"&gt;'&amp;lt;%= this.tcTest.ClientID %&amp;gt;'&lt;/span&gt;);&lt;br /&gt;        alert(tabContainer);&lt;br /&gt;        &lt;span class="rem"&gt;// make it visible&lt;/span&gt;&lt;br /&gt;       &lt;span class="rem"&gt;// _updateProgressDiv.style.display='';       &lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="kwrd"&gt;function&lt;/span&gt; endRequest(sender, args) {&lt;br /&gt;        &lt;span class="rem"&gt;// make it invisible&lt;/span&gt;&lt;br /&gt;       &lt;span class="rem"&gt;// _updateProgressDiv.style.display='none';&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;            &lt;br /&gt;        &lt;span class="kwrd"&gt;function&lt;/span&gt; clientActiveTabChanged(sender, args) {&lt;br /&gt;            &lt;span class="rem"&gt;// see if table elements for the grids exist yet&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;var&lt;/span&gt; isTab1Loaded = $get(&lt;span class="str"&gt;'&amp;lt;%= this.gv1.ClientID %&amp;gt;'&lt;/span&gt;);&lt;br /&gt;            &lt;span class="kwrd"&gt;var&lt;/span&gt; isTab2Loaded = $get(&lt;span class="str"&gt;'&amp;lt;%= this.gv2.ClientID %&amp;gt;'&lt;/span&gt;);&lt;br /&gt;            &lt;span class="kwrd"&gt;var&lt;/span&gt; isTab3Loaded = $get(&lt;span class="str"&gt;'&amp;lt;%= this.gv3.ClientID %&amp;gt;'&lt;/span&gt;);&lt;br /&gt;            &lt;br /&gt;            &lt;span class="rem"&gt;// if tab does not exist and it is the active tab, trigger the async-postback&lt;/span&gt;&lt;br /&gt;             alert(isTab1Loaded + &lt;span class="str"&gt;','&lt;/span&gt; + isTab2Loaded + &lt;span class="str"&gt;','&lt;/span&gt; + isTab3Loaded + &lt;span class="str"&gt;':'&lt;/span&gt; + sender.get_activeTabIndex());&lt;br /&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (!isTab1Loaded &amp;amp;&amp;amp; sender.get_activeTabIndex() == 0) {&lt;br /&gt;                &lt;span class="rem"&gt;// load tab1&lt;/span&gt;&lt;br /&gt;               &lt;span class="rem"&gt;// alert('fire1');&lt;/span&gt;&lt;br /&gt;                __doPostBack(&lt;span class="str"&gt;'&amp;lt;%= btn1Trigger.UniqueID %&amp;gt;'&lt;/span&gt;, &lt;span class="str"&gt;''&lt;/span&gt;);&lt;br /&gt;            }&lt;br /&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (!isTab2Loaded &amp;amp;&amp;amp; sender.get_activeTabIndex() == 1 ) {&lt;br /&gt;                &lt;span class="rem"&gt;// load tab2&lt;/span&gt;&lt;br /&gt;              &lt;span class="rem"&gt;//  alert('fire2');&lt;/span&gt;&lt;br /&gt;                __doPostBack(&lt;span class="str"&gt;'&amp;lt;%= btn2Trigger.UniqueID %&amp;gt;'&lt;/span&gt;, &lt;span class="str"&gt;''&lt;/span&gt;);&lt;br /&gt;            }&lt;br /&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (!isTab3Loaded &amp;amp;&amp;amp; sender.get_activeTabIndex() == 2 ) {&lt;br /&gt;                &lt;span class="rem"&gt;// load tab3&lt;/span&gt;&lt;br /&gt;               &lt;span class="rem"&gt;// alert('fire3');&lt;/span&gt;&lt;br /&gt;                __doPostBack(&lt;span class="str"&gt;'&amp;lt;%= btn3Trigger.UniqueID %&amp;gt;'&lt;/span&gt;, &lt;span class="str"&gt;''&lt;/span&gt;);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;script&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;         &lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;input&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="btn1Trigger"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="button"&lt;/span&gt; &lt;span class="attr"&gt;style&lt;/span&gt;&lt;span class="kwrd"&gt;="display:none"&lt;/span&gt; &lt;span class="attr"&gt;onserverclick&lt;/span&gt;&lt;span class="kwrd"&gt;="btn1Trigger_Click"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;input&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="btn2Trigger"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="button"&lt;/span&gt; &lt;span class="attr"&gt;style&lt;/span&gt;&lt;span class="kwrd"&gt;="display:none"&lt;/span&gt; &lt;span class="attr"&gt;onserverclick&lt;/span&gt;&lt;span class="kwrd"&gt;="btn2Trigger_Click"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;input&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="btn3Trigger"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="button"&lt;/span&gt; &lt;span class="attr"&gt;style&lt;/span&gt;&lt;span class="kwrd"&gt;="display:none"&lt;/span&gt; &lt;span class="attr"&gt;onserverclick&lt;/span&gt;&lt;span class="kwrd"&gt;="btn3Trigger_Click"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ajaxc:TabContainer&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="tcTest"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;OnClientActiveTabChanged&lt;/span&gt;&lt;span class="kwrd"&gt;="clientActiveTabChanged"&lt;/span&gt; &lt;span class="attr"&gt;ActiveTabIndex&lt;/span&gt;&lt;span class="kwrd"&gt;="0"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ajaxc:TabPanel&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="tp1"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;HeaderText&lt;/span&gt;&lt;span class="kwrd"&gt;="TabPanel1"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ContentTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ajax:UpdatePanel&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="upnl1"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;UpdateMode&lt;/span&gt;&lt;span class="kwrd"&gt;="Conditional"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ContentTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                        1&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;br&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="gv1"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;Visible&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt; &lt;span class="attr"&gt;DataSourceID&lt;/span&gt;&lt;span class="kwrd"&gt;="sqlLicStatus"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ContentTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Triggers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ajax:AsyncPostBackTrigger&lt;/span&gt; &lt;span class="attr"&gt;ControlID&lt;/span&gt;&lt;span class="kwrd"&gt;="btn1Trigger"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Triggers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ajax:UpdatePanel&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ContentTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ajaxc:TabPanel&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ajaxc:TabPanel&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="tp2"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;HeaderText&lt;/span&gt;&lt;span class="kwrd"&gt;="TabPanel2"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ContentTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ajax:UpdatePanel&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="upnl2"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;UpdateMode&lt;/span&gt;&lt;span class="kwrd"&gt;="Conditional"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ContentTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                        2&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;br&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="gv2"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;Visible&lt;/span&gt;&lt;span class="kwrd"&gt;="False"&lt;/span&gt; &lt;span class="attr"&gt;DataSourceID&lt;/span&gt;&lt;span class="kwrd"&gt;="sqlCondition"&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ContentTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Triggers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ajax:AsyncPostBackTrigger&lt;/span&gt; &lt;span class="attr"&gt;ControlID&lt;/span&gt;&lt;span class="kwrd"&gt;="btn2Trigger"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Triggers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ajax:UpdatePanel&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ContentTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ajaxc:TabPanel&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ajaxc:TabPanel&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="tp3"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;HeaderText&lt;/span&gt;&lt;span class="kwrd"&gt;="TabPanel3"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ContentTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ajax:UpdatePanel&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="upnl3"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;UpdateMode&lt;/span&gt;&lt;span class="kwrd"&gt;="Conditional"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ContentTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                        3&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;br&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="gv3"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;Visible&lt;/span&gt;&lt;span class="kwrd"&gt;="False"&lt;/span&gt; &lt;span class="attr"&gt;DataSourceID&lt;/span&gt;&lt;span class="kwrd"&gt;="sqlCondition"&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ContentTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Triggers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ajax:AsyncPostBackTrigger&lt;/span&gt; &lt;span class="attr"&gt;ControlID&lt;/span&gt;&lt;span class="kwrd"&gt;="btn3Trigger"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Triggers&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ajax:UpdatePanel&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ContentTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ajaxc:TabPanel&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ajaxc:TabContainer&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;    &lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;div&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:SqlDataSource&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="sqlLicStatus"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;br /&gt;            &lt;span class="attr"&gt;ProviderName&lt;/span&gt;&lt;span class="kwrd"&gt;="System.Data.Bar"&lt;/span&gt;&lt;br /&gt;            &lt;span class="attr"&gt;DataSourceMode&lt;/span&gt;&lt;span class="kwrd"&gt;="DataReader"&lt;/span&gt; &lt;br /&gt;            &lt;span class="attr"&gt;ConnectionString&lt;/span&gt;&lt;span class="kwrd"&gt;="foo"&lt;/span&gt; &lt;br /&gt;            &lt;span class="attr"&gt;SelectCommand&lt;/span&gt;&lt;span class="kwrd"&gt;="SELECT foo FROM Validations WHERE bar=102 ORDER BY Code;"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:SqlDataSource&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:SqlDataSource&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="sqlCondition"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;br /&gt;            &lt;span class="attr"&gt;ProviderName&lt;/span&gt;&lt;span class="kwrd"&gt;="System.Data.Foo"&lt;/span&gt;&lt;br /&gt;            &lt;span class="attr"&gt;DataSourceMode&lt;/span&gt;&lt;span class="kwrd"&gt;="DataReader"&lt;/span&gt; &lt;br /&gt;            &lt;span class="attr"&gt;ConnectionString&lt;/span&gt;&lt;span class="kwrd"&gt;="foo"&lt;/span&gt; &lt;br /&gt;            &lt;span class="attr"&gt;SelectCommand&lt;/span&gt;&lt;span class="kwrd"&gt;="SELECT foo FROM Validations WHERE bar=18 ORDER BY Code;"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:SqlDataSource&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;form&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;html&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt; Code Behind: &lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;/// Lazy load TabPanel in a TabContainer&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;/// The update panel contents are fetched if client trigger is fired.&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;/// The client trigger is fired if the target tab is active and the &lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;/// target GridView is not active (visible).&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; Samples_LazyPanel : System.Web.UI.Page&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Page_Load(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; btn1Trigger_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs args)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.gv1.Visible = &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;br /&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.gv1.DataBind();&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; btn2Trigger_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs args)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.gv2.Visible = &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;br /&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.gv2.DataBind();&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; btn3Trigger_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs args)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.gv3.Visible = &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;br /&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.gv3.DataBind();&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-2048582026185809166?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/2048582026185809166/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=2048582026185809166' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2048582026185809166'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2048582026185809166'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/02/lazy-load-panel-courtesy-of.html' title='Lazy Load Panel Courtesy of TabContainer and UpdatePanel'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-2540275498567852109</id><published>2008-02-27T16:25:00.000-08:00</published><updated>2008-02-27T16:31:51.886-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# Find Control'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Control Tree'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Trace'/><title type='text'>Simple and Complex Drilldown for ASP.Net Objects</title><content type='html'>It can be difficult to drill down through an ASPX page to see where your desired object is before you call FindControl. One quick way to figure out the control tree structure is the Document Outline tab of Microsoft Visual Studio. The only caveat is that you will still need to know your Master Page structure.&lt;br /&gt;&lt;br /&gt;The complex overkill way is to use Trace="true" under the Page Directive (at the top of the aspx page.) This has other applications as well. For example, instead of debug prints you can see the state of many variables.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-2540275498567852109?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/2540275498567852109/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=2540275498567852109' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2540275498567852109'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2540275498567852109'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/02/simple-and-complex-drilldown-for-aspnet.html' title='Simple and Complex Drilldown for ASP.Net Objects'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-6625160137192264268</id><published>2008-02-27T00:18:00.000-08:00</published><updated>2008-02-27T00:22:45.472-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# Web User Control'/><title type='text'>Web User Control Library error</title><content type='html'>When you create a User Control from a class and try to drag and drop the control into the design page, you may get an Invalid FORMATETC structure (Exception from HRESULT: 0x80040064 (DV_E_FORMATETC)) error.  Talk about confusing. My solution was to make my (user control) class public.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-6625160137192264268?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/6625160137192264268/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=6625160137192264268' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6625160137192264268'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6625160137192264268'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/02/web-user-control-library-error.html' title='Web User Control Library error'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-6827932395081583936</id><published>2008-02-21T11:46:00.000-08:00</published><updated>2008-02-21T11:49:02.577-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# RadioButtonList'/><title type='text'>Prevent RadioButtonList from forcing a line break</title><content type='html'>Prevent RadioButtonList from forcing a line break by placing the control in a span and set the RepeatLayout attribute to Flow.&lt;br /&gt;&lt;br /&gt;Reference: &lt;a href="http://www.webdeveloper.com/forum/showthread.php?t=138562"&gt;http://www.webdeveloper.com/forum/showthread.php?t=138562&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-6827932395081583936?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/6827932395081583936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=6827932395081583936' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6827932395081583936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6827932395081583936'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/02/prevent-radiobuttonlist-from-forcing.html' title='Prevent RadioButtonList from forcing a line break'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-2167107743811388708</id><published>2008-02-19T18:13:00.000-08:00</published><updated>2008-02-19T18:16:28.947-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# Configuration Mananger'/><title type='text'>Using Web.config hash for variables using add, key, and value</title><content type='html'>Use configuration (web.config) hash to set variables. First, there is the web.config file section: ...&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;appSettings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;key&lt;/span&gt;&lt;span class="kwrd"&gt;="fooLink"&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="http://www.foo.htm"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt; &lt;br /&gt;   &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;appSettings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt; Now in the code-behind I can set a Hyperlink variable as follows:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;HyperLinkFoo.NavigateUrl = ConfigurationManager.AppSettings[&lt;span class="str"&gt;"fooLink"&lt;/span&gt;].ToString().ToLower();&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-2167107743811388708?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/2167107743811388708/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=2167107743811388708' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2167107743811388708'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2167107743811388708'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/02/using-webconfig-hash-for-variables.html' title='Using Web.config hash for variables using add, key, and value'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-2870804076990060583</id><published>2008-02-18T20:26:00.000-08:00</published><updated>2008-02-18T20:34:02.605-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# reset form'/><category scheme='http://www.blogger.com/atom/ns#' term='C# MasterPage'/><title type='text'>Drilling down a nested master page in ASP.NET to reset a form</title><content type='html'>Here is an example of drilling down a master page in ASP.NET to reset a form's TextBox controls:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; btnqReset_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;try&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            ContentPlaceHolder childMasterContent = (ContentPlaceHolder)Page.Form.FindControl(&lt;span class="str"&gt;"ParentMasterContent"&lt;/span&gt;).FindControl(&lt;span class="str"&gt;"ChildMasterContent"&lt;/span&gt;);&lt;br /&gt;            Control ctrlForm = childMasterContent.FindControl(&lt;span class="str"&gt;"upnlQueryMoreCriteria"&lt;/span&gt;).FindControl(&lt;span class="str"&gt;"pnlQueryMoreCriteria"&lt;/span&gt;);&lt;br /&gt;            Control[] queryControls = { ctrlForm };&lt;br /&gt;            &lt;span class="kwrd"&gt;for&lt;/span&gt; (&lt;span class="kwrd"&gt;int&lt;/span&gt; i = 0; i &amp;lt; 1; i++)&lt;br /&gt;            {&lt;br /&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt; (queryControls[i].Controls != &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;br /&gt;                {&lt;br /&gt;                    &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (Control ct &lt;span class="kwrd"&gt;in&lt;/span&gt; queryControls[i].Controls)&lt;br /&gt;                    {&lt;br /&gt;                        &lt;span class="kwrd"&gt;if&lt;/span&gt; (ct.GetType().ToString().Equals(&lt;span class="str"&gt;"System.Web.UI.WebControls.TextBox"&lt;/span&gt;))&lt;br /&gt;                        {&lt;br /&gt;                            ((TextBox)ct).Text = &lt;span class="str"&gt;""&lt;/span&gt;;&lt;br /&gt;                        }&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        &lt;span class="kwrd"&gt;catch&lt;/span&gt; (Exception ex)&lt;br /&gt;        {&lt;br /&gt;            log.Error(&lt;span class="str"&gt;"Unable to reset query criteria: "&lt;/span&gt; + ex.Message + ex.StackTrace);&lt;br /&gt;            &lt;br /&gt;        }&lt;br /&gt;    } &lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-2870804076990060583?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/2870804076990060583/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=2870804076990060583' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2870804076990060583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2870804076990060583'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/02/drilling-down-nested-master-page-in.html' title='Drilling down a nested master page in ASP.NET to reset a form'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-8577926690422180105</id><published>2008-02-18T20:13:00.000-08:00</published><updated>2008-02-18T20:16:15.748-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# default'/><category scheme='http://www.blogger.com/atom/ns#' term='C# javascript'/><title type='text'>Intercepting return in list menu items in ASP.NET</title><content type='html'>Here is how I was able to intercept the return button in my list menu item when selected, despite a default button on the aspx page:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&amp;lt;li&amp;gt;&amp;lt;a href=&lt;span class="str"&gt;""&lt;/span&gt; onkeydown=&lt;span class="str"&gt;"if (event.keyCode==13)  { window.location.href='http://www.foo.com';}"&lt;/span&gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-8577926690422180105?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/8577926690422180105/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=8577926690422180105' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8577926690422180105'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8577926690422180105'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/02/intercepting-return-in-list-menu-items.html' title='Intercepting return in list menu items in ASP.NET'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-5334832086055757072</id><published>2008-02-16T15:52:00.000-08:00</published><updated>2008-02-16T15:58:55.422-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Web User Control'/><category scheme='http://www.blogger.com/atom/ns#' term='FindControl'/><category scheme='http://www.blogger.com/atom/ns#' term='C# javascript'/><category scheme='http://www.blogger.com/atom/ns#' term='C# MasterPage'/><title type='text'>FindContol Solution to add Javascript to a control from a user control</title><content type='html'>Here is a great solution to finding a control using FindControl method from a user control. TargetcontrolID is the public property for TextBoxFooExtender (User Control). _txt is the targeted TextBox assuming it is found.&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; CreateChildControls()&lt;br /&gt;    {&lt;br /&gt;        txt = (TextBox)&lt;span class="kwrd"&gt;this&lt;/span&gt;.Parent.FindControl(TargetControlID);&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (txt != &lt;span class="kwrd"&gt;null&lt;/span&gt;) {&lt;br /&gt;            _txt.Attributes.Add(&lt;span class="str"&gt;"ondblclick"&lt;/span&gt;, "alert('foo')");&lt;br /&gt;        }&lt;br /&gt;        &lt;span class="kwrd"&gt;base&lt;/span&gt;.CreateChildControls();&lt;br /&gt;    }&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-5334832086055757072?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/5334832086055757072/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=5334832086055757072' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5334832086055757072'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5334832086055757072'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/02/findcontol-solution-to-add-javascript.html' title='FindContol Solution to add Javascript to a control from a user control'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-131854609948368094</id><published>2008-02-15T13:31:00.000-08:00</published><updated>2008-02-15T13:40:11.759-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='C# CollapsiblePanelExtender'/><category scheme='http://www.blogger.com/atom/ns#' term='C# CalendarExtender'/><title type='text'>How to show and hide CalendarExtender and CollapsiblePanel</title><content type='html'>Here is the javascript for expanding or collapsing a collapsible panel:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;        // Used for collapsible panels to toggle collapse or open&lt;br /&gt;        function CollapsiblePanelExtender_Toggle(behaviorId)&lt;br /&gt;        {&lt;br /&gt;          var behavior = $find(behaviorId);&lt;br /&gt;          if (behavior!=null) {&lt;br /&gt;              if (behavior.get_Collapsed()==false) {&lt;br /&gt;                try {behavior._doClose();} catch(e) { }&lt;br /&gt;              }else if (behavior.get_Collapsed()==true) {&lt;br /&gt;                try {behavior._doOpen();} catch(e) { }&lt;br /&gt;              }&lt;br /&gt;          }&lt;br /&gt;        }&lt;br /&gt;        // Used for calendar extenders to toggle show or hide&lt;br /&gt;        function CalendarExtender_Toggle(behaviorId) {&lt;br /&gt;              var behavior = $find(behaviorId);&lt;br /&gt;              if (behavior!=null) {&lt;br /&gt;                  if (behavior._isOpen==true) {&lt;br /&gt;                    try {behavior.hide();} catch(e) { }&lt;br /&gt;                  }else if (behavior._isOpen==false) {&lt;br /&gt;                    try {behavior.show();} catch(e) { }&lt;br /&gt;                  }&lt;br /&gt;              }&lt;br /&gt;        }    &lt;/pre&gt;The Calendar show and hide behavior is above. Note: it may be helpful to use an empty label/image for the calendarExtender popupcontrolId to manage show/hide behavior.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-131854609948368094?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/131854609948368094/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=131854609948368094' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/131854609948368094'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/131854609948368094'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/02/how-to-show-and-hide-calendarextender.html' title='How to show and hide CalendarExtender and CollapsiblePanel'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-5683746395515036746</id><published>2008-02-12T10:02:00.000-08:00</published><updated>2008-02-12T10:12:08.621-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# Web User Control'/><title type='text'>Understanding Default Values for User Web Controls</title><content type='html'>Understanding default values for User Web Controls can be confusing.&lt;br /&gt;First, there is the DefaultValue for the code behind, which does not act as a default value, but as a default property value for the properties window. Here is the Default Property Value for the properties window set in the ascx.cs page:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    [Browsable(&lt;span class="kwrd"&gt;true&lt;/span&gt;)]&lt;br /&gt;    [DefaultValue(&lt;span class="str"&gt;""&lt;/span&gt;)]&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; Text&lt;br /&gt;    {&lt;br /&gt;        get { &lt;span class="kwrd"&gt;return&lt;/span&gt; Label.Text; }&lt;br /&gt;        set {  Label.Text = &lt;span class="kwrd"&gt;value&lt;/span&gt;;&lt;br /&gt;        }&lt;br /&gt;    }&lt;/pre&gt;Now, what you really want is the default value for the control to be set in the ascx page as follows:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:Label&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="Label"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;Text&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:Label&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;You can then manipulate the value in the DataBind, CreateChildControls, or Property section. Be aware that the property section doesn't necessarily fire, hence the need to use the ascx properties.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-5683746395515036746?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/5683746395515036746/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=5683746395515036746' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5683746395515036746'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5683746395515036746'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/02/understanding-default-values-for-user.html' title='Understanding Default Values for User Web Controls'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-99970286803638242</id><published>2008-02-10T11:48:00.000-08:00</published><updated>2008-02-10T12:19:41.462-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# Web User Control'/><category scheme='http://www.blogger.com/atom/ns#' term='Template'/><title type='text'>Creating a ListItemCollection Template User Control</title><content type='html'>Creating a ListItemCollection Template User Control. Here are the 3 files necessary. A link to the reference link is below.&lt;br /&gt;&lt;br /&gt;First: The user control code-behind:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;[DefaultEvent(&lt;span class="str"&gt;"SelectedIndexChanged"&lt;/span&gt;),&lt;br /&gt;Designer(&lt;span class="str"&gt;"System.Web.UI.Design.WebControls.ListControlDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"&lt;/span&gt;),&lt;br /&gt;ParseChildren(&lt;span class="kwrd"&gt;true&lt;/span&gt;, &lt;span class="str"&gt;"Items"&lt;/span&gt;), ControlValueProperty(&lt;span class="str"&gt;"SelectedValue"&lt;/span&gt;),&lt;br /&gt;DataBindingHandler(&lt;span class="str"&gt;"System.Web.UI.Design.WebControls.ListControlDataBindingHandler, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"&lt;/span&gt;)]&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; ComboBoxControl : System.Web.UI.UserControl&lt;br /&gt;{&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Page_Load(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; ListItemCollection m_Items;&lt;br /&gt;&lt;br /&gt;  [DefaultValue((&lt;span class="kwrd"&gt;string&lt;/span&gt;)&lt;span class="kwrd"&gt;null&lt;/span&gt;), MergableProperty(&lt;span class="kwrd"&gt;false&lt;/span&gt;), &lt;br /&gt;  PersistenceMode(PersistenceMode.InnerDefaultProperty), &lt;br /&gt;  Editor(&lt;span class="str"&gt;"System.Web.UI.Design.WebControls.ListItemsCollectionEditor,System.Design, Version=2.0.0.0,Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"&lt;/span&gt;,&lt;br /&gt;  &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(UITypeEditor))]     &lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;virtual&lt;/span&gt; ListItemCollection Items&lt;br /&gt;    {&lt;br /&gt;        get&lt;br /&gt;        {&lt;br /&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;this&lt;/span&gt;.m_Items == &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;br /&gt;            {&lt;br /&gt;                &lt;span class="kwrd"&gt;this&lt;/span&gt;.m_Items = &lt;span class="kwrd"&gt;new&lt;/span&gt; ListItemCollection();&lt;br /&gt;            }&lt;br /&gt;            &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;this&lt;/span&gt;.m_Items;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; CreateChildControls()&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;this&lt;/span&gt;.m_Items == &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;br /&gt;        {&lt;br /&gt;            &lt;span class="kwrd"&gt;this&lt;/span&gt;.m_Items = &lt;span class="kwrd"&gt;new&lt;/span&gt; ListItemCollection();&lt;br /&gt;        }&lt;br /&gt;        &lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (m_Items.Count&amp;gt;0) {&lt;br /&gt;            &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (ListItem item &lt;span class="kwrd"&gt;in&lt;/span&gt; m_Items)&lt;br /&gt;            {&lt;br /&gt;                _ComboBoxControl.Items.Add(item);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; DataBind()&lt;br /&gt;    {&lt;br /&gt;        CreateChildControls();&lt;br /&gt;        ChildControlsCreated = &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;br /&gt;        _ComboBoxControl.DataBind();&lt;br /&gt;        &lt;span class="kwrd"&gt;base&lt;/span&gt;.DataBind();&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;Next, the User control&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="asp"&gt;&amp;lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="ComboBoxControl.ascx.cs" Inherits="ComboBoxControl" %&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:DropDownList&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="_ComboBoxControl"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:DropDownList&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;And finally the aspx:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;uc1:ComboBoxControl&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="ComboBoxControl1"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Items&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:ListItem&lt;/span&gt; &lt;span class="attr"&gt;Value&lt;/span&gt;&lt;span class="kwrd"&gt;="Value1"&lt;/span&gt; &lt;span class="attr"&gt;Text&lt;/span&gt;&lt;span class="kwrd"&gt;="Text1"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:ListItem&lt;/span&gt; &lt;span class="attr"&gt;Value&lt;/span&gt;&lt;span class="kwrd"&gt;="Value2"&lt;/span&gt; &lt;span class="attr"&gt;Text&lt;/span&gt;&lt;span class="kwrd"&gt;="Text2"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:ListItem&lt;/span&gt; &lt;span class="attr"&gt;Value&lt;/span&gt;&lt;span class="kwrd"&gt;="Value3"&lt;/span&gt; &lt;span class="attr"&gt;Text&lt;/span&gt;&lt;span class="kwrd"&gt;="Text3"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:ListItem&lt;/span&gt; &lt;span class="attr"&gt;Value&lt;/span&gt;&lt;span class="kwrd"&gt;="Value4"&lt;/span&gt; &lt;span class="attr"&gt;Text&lt;/span&gt;&lt;span class="kwrd"&gt;="Text4"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Items&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;uc1:ComboBoxControl&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Credit to: &lt;a href="http://developers.de/blogs/damir_dobric/archive/2007/03/30/Implementing-Custom-UserControl-with-ListItem-collection.aspx"&gt;http://developers.de/blogs/damir_dobric/archive/2007/03/30/Implementing-Custom-UserControl-with-ListItem-collection.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-99970286803638242?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/99970286803638242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=99970286803638242' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/99970286803638242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/99970286803638242'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/02/creating-listitemcollection-template.html' title='Creating a ListItemCollection Template User Control'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-8263091190108306198</id><published>2008-02-08T00:22:00.000-08:00</published><updated>2008-02-08T00:27:12.397-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CA Anti-Virus'/><category scheme='http://www.blogger.com/atom/ns#' term='Vista'/><title type='text'>Installing CA Anti-virus with error on open</title><content type='html'>I had a Vista problem installing the av_en_32.exe install wizard after I move the file from another computer. It gave some error that Windows cannot access the specified device, path, or file . You may not have the appropriate permissions to access them.&lt;br /&gt;&lt;br /&gt;Solution: Right-click the icon and Unblock.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-8263091190108306198?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/8263091190108306198/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=8263091190108306198' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8263091190108306198'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8263091190108306198'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/02/installing-ca-anti-virus-with-error-on.html' title='Installing CA Anti-virus with error on open'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-6633382771209999621</id><published>2008-02-05T20:40:00.000-08:00</published><updated>2008-02-05T20:54:51.474-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# Web User Control'/><category scheme='http://www.blogger.com/atom/ns#' term='INamingContainer'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Interface'/><title type='text'>Web Control IDs INamingContainer to avoid duplicate IDs</title><content type='html'>The ID property of the WebUserControl for controls that may be used mulitiple times in an aspx page should not be repeated. Simple implment the INamingContainer to prevent duplicate IDs as follows:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;partial&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; UCRepeater : System.Web.UI.UserControl, INamingContainer&lt;/pre&gt;Marker Interface - An interface that does not require explicit implementation.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-6633382771209999621?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/6633382771209999621/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=6633382771209999621' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6633382771209999621'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6633382771209999621'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2008/02/web-control-ids.html' title='Web Control IDs INamingContainer to avoid duplicate IDs'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-2223176812516841178</id><published>2007-12-29T19:32:00.000-08:00</published><updated>2007-12-29T19:41:00.636-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# Web User Control'/><title type='text'>Web User Control shortcut</title><content type='html'>I just discovered a Web User Control shortcut for using your controls in apsx pages.&lt;br /&gt;As per the reference link's example, add your implementation of this example:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;        &amp;lt;add tagPrefix=&lt;span class="str"&gt;"scottgu"&lt;/span&gt; src=&lt;span class="str"&gt;"~/Controls/Footer.ascx"&lt;/span&gt; tagName=&lt;span class="str"&gt;"footer"&lt;/span&gt;/&amp;gt;&lt;br /&gt;        &amp;lt;add tagPrefix=&lt;span class="str"&gt;"ControlVendor"&lt;/span&gt; assembly=&lt;span class="str"&gt;"ControlVendorAssembly"&lt;/span&gt;/&amp;gt;&lt;/pre&gt;All in the Web.config file in the &lt;configuration&gt;&lt;system.web&gt;&lt;pages&gt;&lt;controls&gt; elements. &lt;br /&gt;&lt;br /&gt;Then you can reference it in aspx as &lt;myTagPrefix:myTagName ID="foo" runat="server"/&gt;&lt;br /&gt;&lt;br /&gt;Reference: &lt;a href="http://weblogs.asp.net/scottgu/archive/2006/11/26/tip-trick-how-to-register-user-controls-and-custom-controls-in-web-config.aspx"&gt;Link&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-2223176812516841178?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/2223176812516841178/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=2223176812516841178' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2223176812516841178'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2223176812516841178'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/12/web-user-control-shortcut.html' title='Web User Control shortcut'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-7402128523437408345</id><published>2007-12-20T17:26:00.001-08:00</published><updated>2007-12-20T17:30:53.757-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CSS'/><title type='text'>Microsoft Visual Web, CSS, and Images link bug</title><content type='html'>Here's a clue to avoid a bug with Microsoft Visual Web, CSS, and Images. I used the CSS style tool to add an image to an element, but the image would not show.  The cause was a faulty link to the image. &lt;br /&gt;&lt;br /&gt;Here is an example. I edit my StyleSheet.css in the css folder. I add an image from the brother folder named images. The link will say images/mypic.gif, but it is actually ../images/mypic.gif. Problem solved.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-7402128523437408345?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/7402128523437408345/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=7402128523437408345' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/7402128523437408345'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/7402128523437408345'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/12/microsoft-visual-web-css-and-images.html' title='Microsoft Visual Web, CSS, and Images link bug'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-2776886807445332851</id><published>2007-12-14T10:07:00.000-08:00</published><updated>2007-12-14T10:17:40.365-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# String'/><title type='text'>C# string is null or empty</title><content type='html'>Here's another shortcut method to make sure the string is not null and not empty. What I find interesting is that using myString.length&gt;0  is supposedly more efficient than myString != string.empty. &lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (!String.IsNullOrEmpty(myString))&lt;br /&gt;        {&lt;br /&gt;            myString = &lt;span class="str"&gt;"myString != null &amp;amp;&amp;amp; myString != string.Empty"&lt;/span&gt;;&lt;br /&gt;        }&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-2776886807445332851?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/2776886807445332851/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=2776886807445332851' title='11 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2776886807445332851'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2776886807445332851'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/12/c-string-is-null-or-empty.html' title='C# string is null or empty'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>11</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-1397183921088635342</id><published>2007-12-14T09:23:00.000-08:00</published><updated>2007-12-14T09:29:06.648-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# String'/><title type='text'>C# string extract tag method</title><content type='html'>This extracts a tagged string. For example, string findTagValue = extractTag ("&lt;myTag&gt;Foo&lt;/myTag&gt;", "&lt;myTag&gt;", "&lt;/myTag&gt;"); This would fetch Foo.&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; extractTag(&lt;span class="kwrd"&gt;string&lt;/span&gt; original, &lt;span class="kwrd"&gt;string&lt;/span&gt; beginTag, &lt;span class="kwrd"&gt;string&lt;/span&gt; endTag)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; retVal = &lt;span class="kwrd"&gt;string&lt;/span&gt;.Empty;&lt;br /&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; begin = original.IndexOf(beginTag);&lt;br /&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; end = -1;&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (begin &amp;gt; 0)&lt;br /&gt;        {&lt;br /&gt;            end = original.IndexOf(endTag, begin);&lt;br /&gt;        }&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; ((begin &amp;gt; 0))&lt;br /&gt;        {&lt;br /&gt;            &lt;span class="kwrd"&gt;if&lt;/span&gt; ((end &amp;gt; begin))&lt;br /&gt;            {&lt;br /&gt;                retVal = original.Substring((begin+beginTag.Length), (end - begin-endTag.Length));&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; retVal;&lt;br /&gt;    }&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-1397183921088635342?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/1397183921088635342/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=1397183921088635342' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1397183921088635342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1397183921088635342'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/12/c-string-extract-tag-method.html' title='C# string extract tag method'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-8690583553961558205</id><published>2007-12-13T23:52:00.000-08:00</published><updated>2007-12-14T00:02:13.865-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# default'/><category scheme='http://www.blogger.com/atom/ns#' term='C# properties'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Handy C# tricks</title><content type='html'>Here are some handy C# tricks to increase productivity.&lt;br /&gt;First, the code:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;div class="csharpcode"&gt;&lt;br /&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;//&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre&gt;        &lt;span class="rem"&gt;// Summary:&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;//     Gets or sets a value that indicates whether the System.Web.UI.WebControls.MenuItem&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre&gt;        &lt;span class="rem"&gt;//     object is enabled, allowing the item to display a pop-out image and any child&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;//     menu items.&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre&gt;        &lt;span class="rem"&gt;//&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre class="alt"&gt;        &lt;span class="rem"&gt;// Returns:&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre&gt;        &lt;span class="rem"&gt;//     true if the menu item is enabled; otherwise, false.&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre class="alt"&gt;        [Browsable(&lt;span class="kwrd"&gt;true&lt;/span&gt;)]&lt;/pre&gt;&lt;br /&gt;&lt;pre&gt;        [DefaultValue(&lt;span class="kwrd"&gt;true&lt;/span&gt;)]&lt;/pre&gt;&lt;br /&gt;&lt;pre class="alt"&gt;        &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;bool&lt;/span&gt; Enabled { get; set; }&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;The [Browsable(true)] allows the properties window to display the property or event.&lt;/li&gt;&lt;li&gt;Default value does as you would expect if the variable is not directly set&lt;/li&gt;&lt;li&gt;Short cut get and sets! Simple.&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-8690583553961558205?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/8690583553961558205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=8690583553961558205' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8690583553961558205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8690583553961558205'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/12/handy-c-tricks.html' title='Handy C# tricks'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-9061908822502520282</id><published>2007-12-06T13:48:00.000-08:00</published><updated>2007-12-06T14:44:34.560-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# javascript'/><title type='text'>C# ASP.NET using JavaScript</title><content type='html'>For ASP.NET, use the ClientScriptManager to register client scripts.&lt;br /&gt;&lt;br /&gt;For example, in the Page_Load code behind I'll use:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;ClientScript.RegisterClientScriptBlock(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(&lt;span class="kwrd"&gt;string&lt;/span&gt;), &lt;span class="str"&gt;"MyScriptShow"&lt;/span&gt;, &lt;span class="str"&gt;"&amp;lt;script language=javascript&amp;gt;function showIt() { alert('showed it'); }&amp;lt;/script&amp;gt;"&lt;/span&gt;);&lt;/pre&gt;&lt;br /&gt;If the javascript was in a js file register it in the code behind with:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;ClientScript.RegisterClientScriptBlock(&lt;span class="kwrd"&gt;typeof&lt;/span&gt;(&lt;span class="kwrd"&gt;string&lt;/span&gt;), &lt;span class="str"&gt;"myScripts"&lt;/span&gt;, &lt;span class="str"&gt;"&amp;lt;script language='javascript' src='scripts/myScripts.js'&amp;gt;&amp;lt;/script&amp;gt;"&lt;/span&gt;);&lt;/pre&gt;&lt;br /&gt;In the ASPX page I'll use;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:Button&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="Button1"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;OnClientClick&lt;/span&gt;&lt;span class="kwrd"&gt;="showIt()"&lt;/span&gt; &lt;span class="attr"&gt;Text&lt;/span&gt;&lt;span class="kwrd"&gt;="Button"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;Resource links: &lt;a href="http://msdn2.microsoft.com/en-us/library/system.web.ui.clientscriptmanager(VS.80).aspx"&gt;link&lt;/a&gt;, &lt;a href="http://msdn2.microsoft.com/en-us/library/aa479011.aspx"&gt;link&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Note: Use the ClientScript.RegisterClientScriptBlock or ClientScript.Register_x methods (since Page.Register_x methods are version 1.1)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-9061908822502520282?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/9061908822502520282/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=9061908822502520282' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/9061908822502520282'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/9061908822502520282'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/12/c-aspnet-using-javascript.html' title='C# ASP.NET using JavaScript'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-2809043431185973936</id><published>2007-12-06T09:46:00.000-08:00</published><updated>2007-12-06T09:49:45.832-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='environmental variable'/><title type='text'>Setting the path environmental variable in XP and Vista</title><content type='html'>Setting the path environmental variable in XP and Vista.&lt;br /&gt;&lt;br /&gt;It is often convenient to set the path environmental variable to call commands. For example, the "javac MyClass.java" command would use the javac command located in the path to compile the MyClass.java file to an executable. Here is how to set it up:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;For Windows XP:&lt;br /&gt;Start-&gt; Control Panel -&gt; System -&gt; Advance Tab -&gt; Environmental Variables.&lt;br /&gt;Select Path -&gt; Edit.&lt;br /&gt;Append ";myPath" to environment variable, where myPath is the directory that contains your resources..&lt;br /&gt;OK&lt;br /&gt;&lt;br /&gt;For Windows Vista:&lt;br /&gt;Start -&gt; Control Panel -&gt; System and Maintenance -&gt; System -&gt; Advanced system settings&lt;br /&gt;click Continue&lt;br /&gt;Select  Environmental Variables&lt;br /&gt;Select Path -&gt; Edit.&lt;br /&gt;Append ";myPath" to environment variable, where myPath is the directory that contains your resources..&lt;br /&gt;OK&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-2809043431185973936?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/2809043431185973936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=2809043431185973936' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2809043431185973936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2809043431185973936'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/12/setting-path-environmental-variable-in.html' title='Setting the path environmental variable in XP and Vista'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-3536412220199519346</id><published>2007-12-06T08:27:00.001-08:00</published><updated>2007-12-06T08:40:28.562-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java'/><category scheme='http://www.blogger.com/atom/ns#' term='gwt'/><title type='text'>Using Google Web Toolkit gwt on Windows</title><content type='html'>Here's a quick start to using Google's Web Toolkit or gwt.&lt;br /&gt;&lt;br /&gt;1. Download latest gwt release at &lt;a href="http://code.google.com/webtoolkit/download.html"&gt;link&lt;/a&gt;.&lt;br /&gt;2. Unzip gwt_x to target directory. I used C:/Program Files/Google.&lt;br /&gt;&lt;br /&gt;Now to create Eclipse projects do the following:&lt;br /&gt;1. Append to the path environmental variable the target directory such as ";C:/Program Files/Google/gwt_x" , where gwt_x is the gwt version installed.&lt;br /&gt;&lt;br /&gt;To create an Eclipse project called "MyProject":&lt;br /&gt;1. use the command prompt and navigate (cd) to the Eclipse workspace. Mine was "C:\work\workspace\". &lt;br /&gt;2. Create a folder via "mkdir MyProject".&lt;br /&gt;3. "cd MyProject"&lt;br /&gt;4. Create project via "projectCreator -eclipse MyProject"&lt;br /&gt;5. Create application via "applicationCreator -eclipse MyProject com.mycompany.client.MyApplication"&lt;br /&gt;&lt;br /&gt;To open the Eclipse Project:&lt;br /&gt;1. In Eclipse: File-&gt;Import-&gt;General-&gt;Existing Projects into workspace&lt;br /&gt;2. Select the MyProject directory that you originally created.&lt;br /&gt;&lt;br /&gt;Other References:&lt;br /&gt;&lt;a href="http://code.google.com/webtoolkit/gettingstarted.html#New"&gt;link&lt;/a&gt;, &lt;a href="http://www.eclipsezone.com/eclipse/forums/t73289.html"&gt;link&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-3536412220199519346?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/3536412220199519346/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=3536412220199519346' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3536412220199519346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3536412220199519346'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/12/using-google-web-toolkit-gwt-on-windows.html' title='Using Google Web Toolkit gwt on Windows'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-3630801978056727649</id><published>2007-12-04T13:57:00.000-08:00</published><updated>2007-12-04T14:31:46.693-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# Web User Control'/><title type='text'>Creating a Web User Control</title><content type='html'>Creating a Custom Web Control.&lt;br /&gt;Within Visual Studio:&lt;br /&gt;To keep organized, I create a company/website/user folder. Within the folder I create another folder named Controls. For example I'll have this directory structure: FooInc/Controls.&lt;br /&gt;&lt;br /&gt;Within that folder, rt. click and Add New Item. Select the WebUserControl option. I'll name this one WebUserControl_DatePanel.ascx. &lt;br /&gt;&lt;br /&gt;Switch to design view. Add a Panel (named Panel1 by default). Add a Label (named Label1 by default) within Panel1. Set Panel1's background to cyan for a custom feel.&lt;br /&gt;&lt;br /&gt;In the load Event of WebUserControl_DatePanel.ascx, add the following:&lt;br /&gt;Label1.Text = DateTime.Now.ToString();&lt;br /&gt;&lt;br /&gt;Now save and close those files.&lt;br /&gt;&lt;br /&gt;In your project, create a new Web Form named WebUser.aspx. Switch to design view.&lt;br /&gt;&lt;br /&gt;From the Solution Explorer, drag the WebUserControl_DatePanel.ascx onto the page (much like adding a CSS file). Switch to Source View.&lt;br /&gt;&lt;br /&gt;You will notice the following header:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="asp"&gt;&amp;lt;%@ Register Src="FooInc/Controls/WebUserControl_DatePanel.ascx" TagName="WebUserControl_DatePanel"&lt;br /&gt;    TagPrefix="uc1" %&amp;gt;&lt;/span&gt;&lt;/pre&gt;You will also notice the following web user control in the body:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;uc1:WebUserControl_DatePanel&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="WebUserControl_DatePanel1"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;There it is. You can add custom functions at the web user control source if you want additional functionality.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-3630801978056727649?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/3630801978056727649/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=3630801978056727649' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3630801978056727649'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3630801978056727649'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/12/creating-web-user-control.html' title='Creating a Web User Control'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-6467226630004373080</id><published>2007-11-29T20:11:00.000-08:00</published><updated>2007-11-29T20:18:50.772-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='C# ADO paging'/><title type='text'>How to implement Ajaxified details view hide on PageIndexChanging</title><content type='html'>Previously I showed how to enable DetailsView with a Select button (&lt;a href="http://techron.blogspot.com/2007/11/how-to-implement-select-on-gridview1.html"&gt;link&lt;/a&gt;). But here is how to get rid of the DetailsView if Paging is enabled by using the PageIndexChanging method. &lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; GridView1_PageIndexChanging(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, GridViewPageEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="rem"&gt;// get rid of the details view&lt;/span&gt;&lt;br /&gt;        DetailsView1.DataSource = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;br /&gt;        DetailsView1.DataBind();&lt;br /&gt;&lt;br /&gt;        GridView1.PageIndex = e.NewPageIndex;&lt;br /&gt;        GridView1.DataBind();&lt;br /&gt;    }&lt;/pre&gt; To Ajaxify it within an update panel, add a Trigger for the Gridview1 object and the PageIndexChanging event.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-6467226630004373080?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/6467226630004373080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=6467226630004373080' title='9 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6467226630004373080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6467226630004373080'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/11/how-to-implement-ajaxified-details-view.html' title='How to implement Ajaxified details view hide on PageIndexChanging'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>9</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-251422741073651888</id><published>2007-11-29T11:17:00.000-08:00</published><updated>2007-11-29T11:19:57.830-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# random'/><category scheme='http://www.blogger.com/atom/ns#' term='VB random'/><title type='text'>Generate Random numbers</title><content type='html'>Here's a quick one on how to generate random numbers. &lt;a href="http://authors.aspalliance.com/brettb/RandomNumbersInVB.NET.asp"&gt;link&lt;/a&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;Random rnd = &lt;span class="kwrd"&gt;new&lt;/span&gt; Random();&lt;br /&gt;&lt;span class="kwrd"&gt;int&lt;/span&gt; myRandom = rnd.Next();&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-251422741073651888?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/251422741073651888/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=251422741073651888' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/251422741073651888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/251422741073651888'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/11/generate-random-numbers.html' title='Generate Random numbers'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-6591474280450425561</id><published>2007-11-29T09:32:00.001-08:00</published><updated>2007-11-29T09:44:57.001-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# MasterPage'/><title type='text'>Implementing Dynamic Hyperlink of Current Page</title><content type='html'>Here's how to implement a dynamic HyperLink of the current page based on the current pages title and current URL without the query string parameters. This is located in the Master Page.&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Page_Load(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        hlPageTitle.Text = Page.Title.ToString();&lt;br /&gt;        &lt;span class="rem"&gt;// old way would fetch query string paramaters&lt;/span&gt;&lt;br /&gt;        &lt;span class="rem"&gt;//hlPageTitle.NavigateUrl = Request.Url.AbsoluteUri.ToString();&lt;/span&gt;&lt;br /&gt;        hlPageTitle.NavigateUrl = Request.Url.GetLeftPart(UriPartial.Path);&lt;br /&gt;    }&lt;/pre&gt;Reference &lt;a href="http://forums.asp.net/p/680870/680870.aspx"&gt;link&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-6591474280450425561?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/6591474280450425561/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=6591474280450425561' title='38 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6591474280450425561'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6591474280450425561'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/11/implementing-dynamic-hyperlink-of.html' title='Implementing Dynamic Hyperlink of Current Page'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>38</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-7314159414547406454</id><published>2007-11-26T10:27:00.000-08:00</published><updated>2007-11-28T20:13:18.307-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# AJAX'/><title type='text'>Fixing WebForms.PageRequestManagerServerErrorException Status code 500</title><content type='html'>Here's a fix for the error WebForms.PageRequestManagerServerErrorException Status code 500.&lt;br /&gt;I modified the MasterPage's ScriptManager as follows:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:ScriptManager&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="ScriptManager1"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="attr"&gt;EnablePartialRendering&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:ScriptManager&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;UPDATE: This might fix the error, but it limits the functionality by not allowing Partial Page Rendering. This may not be acceptable. Here is a hint to avoid breaking the AJAX:&lt;br /&gt;&lt;br /&gt;Hint: Be careful when changing Control names. The IDE won't catch the name change in the Extenders section of the TargetControlID.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-7314159414547406454?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/7314159414547406454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=7314159414547406454' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/7314159414547406454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/7314159414547406454'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/11/fixing-webformspagerequestmanagerserver.html' title='Fixing WebForms.PageRequestManagerServerErrorException Status code 500'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-1802407252353568741</id><published>2007-11-25T12:01:00.000-08:00</published><updated>2007-11-25T12:04:05.525-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# ADO paging'/><title type='text'>How to implement Select on a GridView1 with Paging enabled.</title><content type='html'>How to implement Select on a GridView1 with Paging enabled based on a DataTable.&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; GridView1_SelectedIndexChanging(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, GridViewSelectEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="rem"&gt;// e.NewSelectedIndex -&amp;gt; 0 to n&lt;/span&gt;&lt;br /&gt;        &lt;span class="rem"&gt;// GridView1.PageCount -&amp;gt; (n-1) always &lt;/span&gt;&lt;br /&gt;        &lt;span class="rem"&gt;// GridView1.PageIndex -&amp;gt; 0 to Page#&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; rowN = 1 + ((GridView1.PageCount-1) * GridView1.PageIndex + e.NewSelectedIndex);&lt;br /&gt;        DetailsView1.HeaderText = &lt;span class="str"&gt;"Details View of Row "&lt;/span&gt;+ rowN.ToString();&lt;br /&gt;        DetailsView1.PageIndex = rowN - 1;&lt;br /&gt;        GridView1.SelectedIndex = rowN - 1;&lt;br /&gt;        DetailsView1.DataSource = Cache[&lt;span class="str"&gt;"dt"&lt;/span&gt;];        &lt;br /&gt;        DetailsView1.DataBind();&lt;br /&gt;    }&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-1802407252353568741?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/1802407252353568741/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=1802407252353568741' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1802407252353568741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1802407252353568741'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/11/how-to-implement-select-on-gridview1.html' title='How to implement Select on a GridView1 with Paging enabled.'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-3876540596175590277</id><published>2007-11-25T11:46:00.000-08:00</published><updated>2007-11-25T12:01:46.557-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# ADO paging'/><title type='text'>How to enable paging on a GridView that is bound to a DataTable.</title><content type='html'>How to enable paging on a GridView that is bound to a DataTable. On the GridView, simply &lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; GridView1_PageIndexChanging(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, GridViewPageEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        GridView1.PageIndex = e.NewPageIndex;&lt;br /&gt;        GridView1.DataSource = Cache[&lt;span class="str"&gt;"dt"&lt;/span&gt;];&lt;br /&gt;        GridView1.DataBind();&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.velocityreviews.com/forums/t116012-gridviews-paging-feature-not-working.html"&gt;link&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-3876540596175590277?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/3876540596175590277/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=3876540596175590277' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3876540596175590277'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3876540596175590277'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/11/how-to-enable-paging-on-gridview-that.html' title='How to enable paging on a GridView that is bound to a DataTable.'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-2697101127308924637</id><published>2007-11-17T10:19:00.000-08:00</published><updated>2007-11-17T13:16:54.750-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# YahooMail webservice'/><title type='text'>Using Yahoo Mail Web Service hints</title><content type='html'>This should help you use Yahoo Mail Web Service for C# .NET.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;First&lt;/span&gt;, go to &lt;a href="http://developer.yahoo.com/mail/code/"&gt;link &lt;/a&gt;and download code sample for C#.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Second&lt;/span&gt;, use the APIs at &lt;a href="http://developer.yahoo.com/mail/"&gt;link&lt;/a&gt;. I prefer the html &lt;a href="http://developer.yahoo.com/mail/docs/html/index.html"&gt;link&lt;/a&gt;.&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Third&lt;/span&gt;, get an application id at &lt;a href="https://developer.yahoo.com/wsregapp/index.php"&gt;link&lt;/a&gt;. Be sure that this is the destination page where you will acquire the credentials using Request.QueryString[xTag].&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Fourth&lt;/span&gt;, the above doesn't really explain a detail that will let the Web Service actually  return Messages.  Make sure that the xTagIsSpecified boolean is set before the request! &lt;br /&gt;NOTE: The code sample below only works with premium accounts. Accounts &lt;a href="http://developer.yahoo.com/mail/account_types.html"&gt;link&lt;/a&gt;.&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;                &lt;span class="rem"&gt;// &amp;lt;ListMessages&amp;gt;                &lt;/span&gt;&lt;br /&gt;                &lt;span class="rem"&gt;// ListMessages, lists the messages in a given folder.&lt;/span&gt;&lt;br /&gt;                ListMessages listRequest = &lt;span class="kwrd"&gt;new&lt;/span&gt; ListMessages();&lt;br /&gt;                listRequest.fid = &lt;span class="str"&gt;"Inbox"&lt;/span&gt;;&lt;br /&gt;                listRequest.startMid = 0;&lt;br /&gt;                listRequest.startInfo = 0;&lt;br /&gt;                listRequest.numMid = 10;&lt;br /&gt;                listRequest.numInfo = 1;&lt;br /&gt;                listRequest.startMidSpecified = &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;br /&gt;                listRequest.startInfoSpecified = &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;br /&gt;                listRequest.numMidSpecified = &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;br /&gt;                listRequest.numInfoSpecified = &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;br /&gt;                ListMessagesResponse listResponse = ymwsInstance.ListMessages(listRequest);&lt;br /&gt;                retVal += &lt;span class="kwrd"&gt;string&lt;/span&gt;.Format(&lt;span class="str"&gt;"&amp;lt;br /&amp;gt;Listed folder &amp;lt;b&amp;gt;{0}&amp;lt;/b&amp;gt;, found &amp;lt;b&amp;gt;{1}&amp;lt;/b&amp;gt; message IDs.&amp;lt;br /&amp;gt;"&lt;/span&gt;,&lt;br /&gt;                    listResponse.folder.folderInfo.name, listResponse.mid.Length);&lt;br /&gt;                &lt;span class="kwrd"&gt;string&lt;/span&gt;[] listedMed = ymwsInstance.ListMessages(listRequest).mid;                &lt;br /&gt;                // &amp;lt;/ListMessages&amp;gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-2697101127308924637?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/2697101127308924637/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=2697101127308924637' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2697101127308924637'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2697101127308924637'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/11/using-yahoo-mail-web-service-hints.html' title='Using Yahoo Mail Web Service hints'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-7665458940259544187</id><published>2007-11-14T17:09:00.001-08:00</published><updated>2007-11-15T14:54:32.702-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# documentation'/><title type='text'>Well documented C# code sample</title><content type='html'>Well documented C# code sample demonstrates region, summary, and parameter documentation.&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="preproc"&gt;#region&lt;/span&gt; well documented sample method sample    &lt;br /&gt;        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="rem"&gt;/// Saves the form size when it is resized.&lt;/span&gt;&lt;br /&gt;        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="rem"&gt;/// &amp;lt;param name="sender"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="rem"&gt;/// &amp;lt;param name="e"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; SampleBrowser_SizeChanged(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            Properties.Settings.Default.FormClientSize = &lt;span class="kwrd"&gt;this&lt;/span&gt;.ClientSize;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span class="rem"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="rem"&gt;/// Saves all settings when form is closed.&lt;/span&gt;&lt;br /&gt;        &lt;span class="rem"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="preproc"&gt;#endregion&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;Note: In addition to "param", one can use:&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    /// &amp;lt;returns&amp;gt;State of log &lt;span class="kwrd"&gt;in&lt;/span&gt;&amp;lt;/returns&amp;gt;&lt;/pre&gt;&lt;br /&gt;Also: The #endregion must be on a new line!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-7665458940259544187?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/7665458940259544187/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=7665458940259544187' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/7665458940259544187'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/7665458940259544187'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/11/well-documented-c-code-sample.html' title='Well documented C# code sample'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-8086332006462103403</id><published>2007-11-13T10:31:00.001-08:00</published><updated>2007-11-13T14:01:02.481-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# caching'/><title type='text'>Caching Methods in ASP.NET 2.0</title><content type='html'>How To Cache&lt;br /&gt;&lt;br /&gt;        &lt;table border="1" cellpadding="1" cellspacing="1"&gt;&lt;br /&gt;            &lt;tr&gt;&lt;br /&gt;                &lt;TH SCOPE="COL"&gt;Method&lt;/TH&gt;&lt;br /&gt;                &lt;TH SCOPE="COL"&gt;Implementation&lt;/TH&gt;&lt;br /&gt;                &lt;TH SCOPE="COL"&gt;Sample uses&lt;/TH&gt;&lt;br /&gt;            &lt;/tr&gt;&lt;br /&gt;            &lt;tr&gt;&lt;br /&gt;                &lt;td&gt;&lt;br /&gt;                        Programatic Caching&lt;br /&gt;                &lt;/td&gt;&lt;br /&gt;                &lt;td&gt;&lt;br /&gt;                    &lt;strong&gt;&lt;br /&gt;                    Set:&lt;br /&gt;&lt;br /&gt;                    &lt;/strong&gt;&lt;br /&gt;                    &lt;span&gt;Cache.Insert(&lt;/span&gt;&lt;span class="string"&gt;"UniqueKey"&lt;/span&gt;&lt;span&gt;, myData, &lt;/span&gt;&lt;br /&gt;                    &lt;span class="keyword"&gt;null&lt;/span&gt;&lt;span&gt;, DateTime.Now.AddMinutes(5), &lt;/span&gt;&lt;span&gt;System.Web.Caching.Cache.NoSlidingExpiration);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;                    &lt;br /&gt;&lt;br /&gt;                    &lt;strong&gt;Get:&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;                    Cache["UniqueKey"].ToString();&lt;br /&gt;                &lt;/td&gt;&lt;br /&gt;                &lt;td&gt;&lt;br /&gt;                &lt;/td&gt;&lt;br /&gt;            &lt;/tr&gt;&lt;br /&gt;            &lt;tr&gt;&lt;br /&gt;                &lt;td&gt;&lt;br /&gt;                    Session State Caching&lt;/td&gt;&lt;br /&gt;                &lt;td&gt;&lt;br /&gt;                    &lt;strong&gt;&lt;br /&gt;                    Set:&lt;br /&gt;&lt;br /&gt;                    &lt;/strong&gt;&lt;br /&gt;                    &lt;span&gt;Session.Add(&lt;/span&gt;&lt;span class="string"&gt;"UniqueKey"&lt;/span&gt;&lt;span&gt;, myData); &lt;/span&gt;&lt;br /&gt;                    &lt;br /&gt;&lt;br /&gt;                    &lt;br /&gt;&lt;br /&gt;                    &lt;strong&gt;&lt;br /&gt;                    Get:&lt;br /&gt;&lt;br /&gt;                    &lt;/strong&gt;&lt;br /&gt;                    &lt;span&gt;Session[&lt;/span&gt;&lt;span class="string"&gt;"UniqueKey"&lt;/span&gt;&lt;span&gt;]; &lt;/span&gt;&lt;br /&gt;                &lt;/td&gt;&lt;br /&gt;                &lt;td &gt;&lt;br /&gt;                &lt;/td&gt;&lt;br /&gt;            &lt;/tr&gt;&lt;br /&gt;            &lt;tr&gt;&lt;br /&gt;                &lt;td &gt;&lt;br /&gt;                    Caching to Disk&lt;/td&gt;&lt;br /&gt;                &lt;td &gt;&lt;br /&gt;                    &lt;a href="http://msdn.microsoft.com/library/en-us/dnpag2/html/caching1.asp"&gt;Application Cache Block&lt;/a&gt;&lt;br /&gt;                &lt;/td&gt;&lt;br /&gt;                &lt;td&gt;&lt;br /&gt;                &lt;/td&gt;&lt;br /&gt;            &lt;/tr&gt;&lt;br /&gt;            &lt;tr&gt;&lt;br /&gt;                &lt;td &gt;&lt;br /&gt;                    Caching to Database&lt;/td&gt;&lt;br /&gt;                &lt;td &gt;&lt;br /&gt;                    &lt;a href="http://www.codeproject.com/useritems/Caching_in_ASPNET_20.asp"&gt;CodeProject&lt;br /&gt;                        Article&lt;/a&gt;&lt;/td&gt;&lt;br /&gt;                &lt;td &gt;&lt;br /&gt;                &lt;/td&gt;&lt;br /&gt;            &lt;/tr&gt;&lt;br /&gt;        &lt;/table&gt;&lt;br /&gt;        &lt;a href="http://developer.yahoo.com/dotnet/howto-caching_cs.html#overview"&gt;link&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-8086332006462103403?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/8086332006462103403/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=8086332006462103403' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8086332006462103403'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8086332006462103403'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/11/caching-methods-in-aspnet-20.html' title='Caching Methods in ASP.NET 2.0'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-2914992013574542098</id><published>2007-11-12T08:47:00.000-08:00</published><updated>2007-11-12T09:04:33.355-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# MasterPage'/><title type='text'>Modifying labels in MasterPage From MasterPage user Page</title><content type='html'>First, here is how to modify a label in the MasterPage from the MasterPage user Page:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;        Label mpLabel = (Label)Master.FindControl(&lt;span class="str"&gt;"lblPageTitle"&lt;/span&gt;);&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (mpLabel != &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;br /&gt;        {&lt;br /&gt;            mpLabel.Text = &lt;span class="kwrd"&gt;this&lt;/span&gt;.Title.ToString();&lt;br /&gt;        }&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/xxwa0ff0.aspx"&gt;link&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-2914992013574542098?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/2914992013574542098/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=2914992013574542098' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2914992013574542098'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2914992013574542098'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/11/modifying-labels-in-masterpage-from.html' title='Modifying labels in MasterPage From MasterPage user Page'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-8925610812131539573</id><published>2007-11-05T20:08:00.000-08:00</published><updated>2007-11-05T20:50:09.799-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# email'/><title type='text'>Setup an email form for .NET 2.0</title><content type='html'>Here is how I setup the email action for .NET 2.0. I included "using System.Net.Mail;" and "using System.Net;"&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; sTo = &lt;span class="str"&gt;"foo@foo.com"&lt;/span&gt;;&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; sFrom = txtFrom.Text.Trim();&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; sSubject = &lt;span class="str"&gt;"inforequest message"&lt;/span&gt; + DateTime.Now.ToLongDateString();&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; sBody = txtContent.Text.Trim();&lt;br /&gt;        lblStatus.Text = &lt;span class="str"&gt;"Sending... please wait"&lt;/span&gt;;&lt;br /&gt;        MailMessage msg = &lt;span class="kwrd"&gt;new&lt;/span&gt; MailMessage(sFrom, sTo, sSubject, sBody);&lt;br /&gt;        msg.IsBodyHtml = &lt;span class="kwrd"&gt;false&lt;/span&gt;;&lt;br /&gt;        SmtpClient mailObj = &lt;span class="kwrd"&gt;new&lt;/span&gt; SmtpClient(&lt;span class="str"&gt;"mail.foo.com"&lt;/span&gt;);&lt;br /&gt;        mailObj.Credentials = &lt;span class="kwrd"&gt;new&lt;/span&gt; NetworkCredential(&lt;span class="str"&gt;"user"&lt;/span&gt;, &lt;span class="str"&gt;"secret"&lt;/span&gt;); &lt;br /&gt;        mailObj.Send(msg);&lt;br /&gt;        lblStatus.Text = &lt;span class="str"&gt;"Sent "&lt;/span&gt; + msg.Subject + &lt;span class="str"&gt;" to "&lt;/span&gt; + msg.To;&lt;/pre&gt;&lt;br /&gt;references: &lt;a href="http://http://www.dotnetspider.com/namespace/ShowClass.aspx?ClassId=112"&gt;link&lt;/a&gt;&lt;br /&gt;Note: I used "localHost" instead of "mail.foo.com".&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-8925610812131539573?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/8925610812131539573/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=8925610812131539573' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8925610812131539573'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8925610812131539573'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/11/setup-email-form-for-net-20.html' title='Setup an email form for .NET 2.0'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-374176619135872078</id><published>2007-10-25T12:54:00.000-07:00</published><updated>2007-10-25T13:11:31.661-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# ADO'/><title type='text'>Adding a Checkbox Column to a GridView and checking if it is checked.</title><content type='html'>In my project I bind a DataTable to a Gridview.  I have two fields in my DataTable: (bool) isChecked and (string) Value.  Below I bind the data to those fields in the first two columns. The last Column I used a TemplateField and ItemTemplate to create a CheckBox row that is editable.&lt;br /&gt;&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="GridView1"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;br /&gt;                              &lt;span class="attr"&gt;OnDataBound&lt;/span&gt;&lt;span class="kwrd"&gt;="GridView1_DataBound"&lt;/span&gt; &lt;br /&gt;                              &lt;span class="attr"&gt;OnSelectedIndexChanged&lt;/span&gt;&lt;span class="kwrd"&gt;="GridView1_SelectedIndexChanged"&lt;/span&gt; &lt;br /&gt;                              &lt;span class="attr"&gt;AutoGenerateColumns&lt;/span&gt;&lt;span class="kwrd"&gt;="False"&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Columns&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:CheckBoxField&lt;/span&gt; &lt;span class="attr"&gt;DataField&lt;/span&gt;&lt;span class="kwrd"&gt;="isChecked"&lt;/span&gt; &lt;span class="attr"&gt;HeaderText&lt;/span&gt;&lt;span class="kwrd"&gt;="Select"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:BoundField&lt;/span&gt; &lt;span class="attr"&gt;DataField&lt;/span&gt;&lt;span class="kwrd"&gt;="Value"&lt;/span&gt; &lt;span class="attr"&gt;HeaderText&lt;/span&gt;&lt;span class="kwrd"&gt;="Value"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:TemplateField&lt;/span&gt; &lt;span class="attr"&gt;HeaderText&lt;/span&gt;&lt;span class="kwrd"&gt;="Custom Select"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                            &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:CheckBox&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="chkSelect"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                            &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;ItemTemplate&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                        &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:TemplateField&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;                        &lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Columns&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Once the user edits the Custom Select checkboxes and pushes the button (btnSumbit), I read which fields are checked. If checked, I read from a Hashtable the value associated with the key.&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; btnSubmit_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;            &lt;span class="kwrd"&gt;string&lt;/span&gt; sQueryString = &lt;span class="str"&gt;"http://foo?"&lt;/span&gt;;&lt;br /&gt;            &lt;span class="rem"&gt;// load hashtable with key values&lt;/span&gt;&lt;br /&gt;            Hashtable vhtTags = (Hashtable)Cache[&lt;span class="str"&gt;"htTags"&lt;/span&gt;];&lt;br /&gt;            &lt;span class="kwrd"&gt;bool&lt;/span&gt; isChecked;&lt;br /&gt;            &lt;span class="rem"&gt;// parse through to see what values are selected in gridview&lt;/span&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (GridViewRow vRow &lt;span class="kwrd"&gt;in&lt;/span&gt; GridView1.Rows)&lt;br /&gt;            {&lt;br /&gt;                isChecked = ((CheckBox)vRow.FindControl(&lt;span class="str"&gt;"chkSelect"&lt;/span&gt;)).Checked;&lt;br /&gt;                &lt;span class="kwrd"&gt;if&lt;/span&gt; (isChecked)&lt;br /&gt;                {&lt;br /&gt;                    &lt;span class="kwrd"&gt;string&lt;/span&gt; skey = vRow.Cells[1].Text.Trim();&lt;br /&gt;                    sQueryString += vhtTags[skey].ToString();&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            lblResult.Text = sQueryString;&lt;br /&gt;        }        &lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;Notes: Since the first check column is only for demonstration and the last column is not bound because the default values are false. For the sake of brevity, error checking is left out.&lt;br /&gt;Reference: &lt;a href="http://www.gridviewguy.com/ArticleDetails.aspx?articleID=81"&gt;link&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-374176619135872078?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/374176619135872078/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=374176619135872078' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/374176619135872078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/374176619135872078'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/10/adding-checkbox-column-to-gridview-and.html' title='Adding a Checkbox Column to a GridView and checking if it is checked.'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-5856964222015109193</id><published>2007-10-24T12:01:00.000-07:00</published><updated>2007-10-24T12:05:37.288-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# ADO'/><title type='text'>Reversing the Keys and Values in a Hashtable</title><content type='html'>Here's how to reverse the Keys and Values in a Hashtable.  I use the results and overwrite the original ht.Adds.&lt;br /&gt;The results are output into the TextBox txtReversed.Text&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; btnReverseHash_Click(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        Hashtable ht = &lt;span class="kwrd"&gt;new&lt;/span&gt; Hashtable();&lt;br /&gt;        ht.Add(&lt;span class="str"&gt;"a1"&lt;/span&gt;, &lt;span class="str"&gt;"Ask"&lt;/span&gt;);&lt;br /&gt;        ht.Add(&lt;span class="str"&gt;"a2"&lt;/span&gt;, &lt;span class="str"&gt;"Ask what your country can do for you"&lt;/span&gt;);&lt;br /&gt;        ht.Add(&lt;span class="str"&gt;"a3"&lt;/span&gt;, &lt;span class="str"&gt;"Ask what you can do for your country"&lt;/span&gt;);&lt;br /&gt;        IDictionaryEnumerator _enum = ht.GetEnumerator();&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; sOut = &lt;span class="str"&gt;""&lt;/span&gt;;&lt;br /&gt;        &lt;span class="kwrd"&gt;const&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; _FRONT = &lt;span class="str"&gt;"ht.Add("&lt;/span&gt;;&lt;br /&gt;        &lt;span class="kwrd"&gt;const&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; _END = &lt;span class="str"&gt;");\n"&lt;/span&gt;;&lt;br /&gt;        &lt;span class="kwrd"&gt;const&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; _Q = &lt;span class="str"&gt;"\""&lt;/span&gt;;&lt;br /&gt;        &lt;span class="kwrd"&gt;const&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; _CS = &lt;span class="str"&gt;", "&lt;/span&gt;;&lt;br /&gt;        &lt;span class="kwrd"&gt;while&lt;/span&gt; (_enum.MoveNext())&lt;br /&gt;        {&lt;br /&gt;            sOut += _FRONT + _Q + _enum.Value.ToString() + _Q + _CS&lt;br /&gt;                          + _Q + _enum.Key.ToString() + _Q + _END;&lt;br /&gt;        }&lt;br /&gt;        txtReversed.Text = sOut;&lt;br /&gt;}&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-5856964222015109193?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/5856964222015109193/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=5856964222015109193' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5856964222015109193'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5856964222015109193'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/10/reversing-keys-and-values-in-hashtable.html' title='Reversing the Keys and Values in a Hashtable'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-5913764576517206689</id><published>2007-10-17T13:12:00.000-07:00</published><updated>2007-10-17T13:22:12.976-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# ADO'/><title type='text'>Sorting a GridView that is detached from database and put in a cache</title><content type='html'>First, the GridView needs to have sorting enabled and a sorting method:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="GridView2"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt;&lt;br /&gt;                        &lt;span class="attr"&gt;OnSorting&lt;/span&gt;&lt;span class="kwrd"&gt;="GridView2_Sorting"&lt;/span&gt; &lt;span class="attr"&gt;AllowSorting&lt;/span&gt;&lt;span class="kwrd"&gt;="True"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;                        &lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;Next, the page load and sorting method need to be implemented. I loaded my data from another GridView at the load. There is a Label that is also used. This code is similar to this reference &lt;a href="http://support.microsoft.com/default.aspx/kb/323290"&gt;link&lt;/a&gt;.&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Page_Load(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        DataView myDataView;&lt;br /&gt;&lt;br /&gt;        &lt;span class="rem"&gt;// Retrieve the DataView object from Cache. If not exist, then add DataView object to the Cache.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;        myDataView = (DataView)Cache[&lt;span class="str"&gt;"MyDataSet"&lt;/span&gt;];&lt;br /&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (myDataView == &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;br /&gt;        {&lt;br /&gt;            myDataView = getTable().DefaultView;&lt;br /&gt;            Cache[&lt;span class="str"&gt;"MyDataSet"&lt;/span&gt;] = myDataView;&lt;br /&gt;            myDataView.Sort = myDataView.Table.Columns[0].ToString() + &lt;span class="str"&gt;" ASC"&lt;/span&gt;;&lt;br /&gt;            lblCacheMsg.Text = &lt;span class="str"&gt;"Dataset created explicitly"&lt;/span&gt;;&lt;br /&gt;        }&lt;br /&gt;        &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            lblCacheMsg.Text = &lt;span class="str"&gt;"Dataset retrieved from cache"&lt;/span&gt;;&lt;br /&gt;        }&lt;br /&gt;        GridView2.DataSource = myDataView;&lt;br /&gt;        GridView2.DataBind();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;// Verbose sort version&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; GridView2_Sorting(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, GridViewSortEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        DataView Source = (DataView)Cache[&lt;span class="str"&gt;"MyDataSet"&lt;/span&gt;];&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; direction = &lt;span class="str"&gt;" DESC"&lt;/span&gt;;&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; curDirecton = Source.Sort.ToString().ToUpper();&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (curDirecton.Contains(direction))&lt;br /&gt;        {&lt;br /&gt;            direction = ASC;&lt;br /&gt;        }&lt;br /&gt;        &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            direction = DESC;&lt;br /&gt;        }        &lt;br /&gt;        Source.Sort = e.SortExpression + &lt;span class="str"&gt;" "&lt;/span&gt; + direction;&lt;br /&gt;        Cache[&lt;span class="str"&gt;"MyDataSet"&lt;/span&gt;] = Source;&lt;br /&gt;        GridView2.DataSource = Source;&lt;br /&gt;        GridView2.DataBind();&lt;br /&gt;        lblE.Text = direction;&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; DataTable getTable()&lt;br /&gt;    {&lt;br /&gt;        DataTable retVal;&lt;br /&gt;        DataTableHelper dth = &lt;span class="kwrd"&gt;new&lt;/span&gt; DataTableHelper(GridView1);&lt;br /&gt;        retVal = dth.getDataTable();&lt;br /&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; retVal;&lt;br /&gt;    }&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-5913764576517206689?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/5913764576517206689/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=5913764576517206689' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5913764576517206689'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/5913764576517206689'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/10/sorting-gridview-that-is-detached-from.html' title='Sorting a GridView that is detached from database and put in a cache'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-2721672364472738102</id><published>2007-10-08T11:54:00.000-07:00</published><updated>2007-10-08T12:27:47.953-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='css ADO'/><title type='text'>Modifying display of your GridView with CSS</title><content type='html'>If you manage multiple GridViews that you want to have the same format, use CSS classes. In the Styles section of the GridView properties there are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;AlternatingRowStyle&lt;/li&gt;&lt;li&gt;EditRowStyle&lt;/li&gt;&lt;li&gt;EmptyDataRowStyle&lt;/li&gt;&lt;li&gt;FooterStyle&lt;/li&gt;&lt;li&gt;HeaderStyle&lt;/li&gt;&lt;li&gt;PagerStyle&lt;/li&gt;&lt;li&gt;RowStyle&lt;/li&gt;&lt;li&gt;SelectedRowStyle&lt;/li&gt;&lt;/ul&gt;In this example I'll create classes in my CSS file as such:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;.tableAnalysisRow {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    border-right:#000 thin solid;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    border-bottom:#000 thin solid;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    background:#fff;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    color:#000;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    border-top:#000 thin solid;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    border-left:#000 thin solid;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    padding:2px 2px 3px 4px;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;.tableAnalysisAlternatingRow {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    border-right:#000 thin solid;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    border-bottom:#000 thin solid;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    background:#DCDCDC;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    color:#000;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    border-top:#000 thin solid;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    border-left:#000 thin solid;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    padding:2px 2px 3px 4px;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;.tableAnalysisHeader {&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    border-right:#000 thick solid;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    border-bottom:#000 thick solid;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    background:#DCDCDC;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    color:#000;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    border-top:#000 thick solid;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    border-left:#000 thick solid;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    font-weight:700;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    border-collapse:separate;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    border-color:#000;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;    padding: 2px 2px 3px 4px;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now just modify the Class property in the appropriate Gridview Style property like the following:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;                &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt; &lt;span class="attr"&gt;ID&lt;/span&gt;&lt;span class="kwrd"&gt;="GridView1"&lt;/span&gt; &lt;span class="attr"&gt;runat&lt;/span&gt;&lt;span class="kwrd"&gt;="server"&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;RowStyle&lt;/span&gt; &lt;span class="attr"&gt;CssClass&lt;/span&gt;&lt;span class="kwrd"&gt;="tableAnalysisRow"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;HeaderStyle&lt;/span&gt; &lt;span class="attr"&gt;CssClass&lt;/span&gt;&lt;span class="kwrd"&gt;="tableAnalysisHeader"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;AlternatingRowStyle&lt;/span&gt; &lt;span class="attr"&gt;CssClass&lt;/span&gt;&lt;span class="kwrd"&gt;="tableAnalysisAlternatingRow"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;                &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;asp:GridView&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;The result GridView is &lt;a href="http://docs.google.com/Doc?id=dcn8vttp_7fk8cb9"&gt;here&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-2721672364472738102?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/2721672364472738102/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=2721672364472738102' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2721672364472738102'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/2721672364472738102'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/10/modifying-display-of-your-gridview-with.html' title='Modifying display of your GridView with CSS'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-6275930288094983722</id><published>2007-10-06T23:52:00.000-07:00</published><updated>2007-10-06T23:56:55.773-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# ADO'/><title type='text'>Swapping GridView DataSourceID from DataSource</title><content type='html'>Here's the simple code for swapping the GridView back to DataSourceID from DataSource:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; DropDownListListsInUser_SelectedIndexChanged(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        GridViewStocksInList.DataSource = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;br /&gt;        GridViewStocksInList.DataSourceID = SqlDataSourceGetStocksInList.ID;&lt;br /&gt;        GridViewStocksInList.DataBind();&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;The solution came from &lt;a href="http://forums.asp.net/p/1100566/1671971.aspx"&gt;here&lt;/a&gt;.&lt;br /&gt;It suggested studying &lt;a href="http://www.asp.net/learn/dataaccess/default.aspx?tabid=63 "&gt;this&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-6275930288094983722?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/6275930288094983722/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=6275930288094983722' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6275930288094983722'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/6275930288094983722'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/10/swapping-gridview-datasourceid-from.html' title='Swapping GridView DataSourceID from DataSource'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-3848984365808807831</id><published>2007-10-05T19:54:00.000-07:00</published><updated>2007-10-05T23:00:24.744-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Help user redirect to secure target page after login and avoid extra navigation</title><content type='html'>Here's a solution for when the user needs to log in before accessing a secure page. This allows the user to avoid going through the menu system to go to the original page desired. I avoid some kind of error by using the false parameter in the redirect. The querystring of note is ReturnUrl.&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Page_Load(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {            &lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (User.Identity.IsAuthenticated == &lt;span class="kwrd"&gt;false&lt;/span&gt;)&lt;br /&gt;        {&lt;br /&gt;            Response.Redirect(&lt;span class="str"&gt;"Login.aspx?ReturnUrl=DesiredPage.aspx"&lt;/span&gt;, &lt;span class="kwrd"&gt;false&lt;/span&gt;);&lt;br /&gt;        }&lt;br /&gt;        &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            MembershipUser user = Membership.GetUser().ProviderUserKey.ToString();&lt;br /&gt;        }&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/ka5ffkce.aspx"&gt;RedirectFromLoginPage Method&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-3848984365808807831?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/3848984365808807831/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=3848984365808807831' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3848984365808807831'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/3848984365808807831'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/10/help-user-redirect-to-secure-target.html' title='Help user redirect to secure target page after login and avoid extra navigation'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-1159696537345638620</id><published>2007-10-04T08:46:00.000-07:00</published><updated>2007-10-04T08:48:43.741-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# ADO'/><title type='text'>Using a GridView to make calculations and avoid Database changes by merging DataTables and using PrimaryKey.</title><content type='html'>Merging DataTables named dt and dt2.&lt;br/&gt; &lt;br/&gt; Before I show the diffences, here are the contents of dt (Figure 1) and dt2 (Figure 2):&lt;br/&gt; &lt;br/&gt; &lt;table border="1" cellspacing="0" id="ctl00_ContentPlaceHolder1_GridView2" rules="all" style="border-collapse:collapse"&gt;   &lt;tbody&gt;   &lt;tr&gt;     &lt;th scope="col"&gt;       Symbol     &lt;/th&gt;     &lt;th scope="col"&gt;       Name     &lt;/th&gt;     &lt;th scope="col"&gt;       Exchange     &lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE     &lt;/td&gt;     &lt;td&gt;       Freddie Mac     &lt;/td&gt;     &lt;td&gt;       NYSE     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;     &lt;td&gt;       Freddie Mac     &lt;/td&gt;     &lt;td&gt;       NYSE     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;     &lt;td&gt;       Freddie Mac     &lt;/td&gt;     &lt;td&gt;       NYSE     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;     &lt;td&gt;       Freddie Mac     &lt;/td&gt;     &lt;td&gt;       NYSE     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;     &lt;td&gt;       Freddie Mac     &lt;/td&gt;     &lt;td&gt;       NYSE     &lt;/td&gt;   &lt;/tr&gt;   &lt;/tbody&gt; &lt;/table&gt; Figure 1. dt&lt;br/&gt; &lt;br/&gt; &lt;table border="1" cellspacing="0" id="ctl00_ContentPlaceHolder1_GridView2" rules="all" style="border-collapse:collapse"&gt;   &lt;tbody&gt;   &lt;tr&gt;     &lt;th scope="col"&gt;       Symbol     &lt;/th&gt;     &lt;th scope="col"&gt;       EPS Growth     &lt;/th&gt;     &lt;th scope="col"&gt;       Lower Price Target     &lt;/th&gt;     &lt;th scope="col"&gt;       Lower % Target     &lt;/th&gt;     &lt;th scope="col"&gt;       Upper Price Target     &lt;/th&gt;     &lt;th scope="col"&gt;       Upper % Target     &lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE     &lt;/td&gt;     &lt;td&gt;       FRE     &lt;/td&gt;     &lt;td&gt;       FRE     &lt;/td&gt;     &lt;td&gt;       FRE     &lt;/td&gt;     &lt;td&gt;       FRE     &lt;/td&gt;     &lt;td&gt;       FRE     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;   &lt;/tr&gt;   &lt;/tbody&gt; &lt;/table&gt; Figure 2. dt2&lt;br/&gt; &lt;br/&gt; In my project I want to use a GridView and append calculated data without changing the database.&lt;br/&gt; My solution is to read the GridView into a DataTable, dt. Then, I make calculations from a PrimaryKey of dt and use the same PrimaryKey for dt2 while adding actual calculations (EPS Growth, Lower Price Target, ... in production version). The final step is to Merge the datatables with dt.Merge(dt2). The result is shown in Figure 3.&lt;br/&gt; &lt;br/&gt; &lt;table border="1" cellspacing="0" id="ctl00_ContentPlaceHolder1_GridView2" rules="all" style="border-collapse:collapse"&gt;   &lt;tbody&gt;   &lt;tr&gt;     &lt;th scope="col"&gt;       Symbol     &lt;/th&gt;     &lt;th scope="col"&gt;       Name     &lt;/th&gt;     &lt;th scope="col"&gt;       Exchange     &lt;/th&gt;     &lt;th scope="col"&gt;       EPS Growth     &lt;/th&gt;     &lt;th scope="col"&gt;       Lower Price Target     &lt;/th&gt;     &lt;th scope="col"&gt;       Lower % Target     &lt;/th&gt;     &lt;th scope="col"&gt;       Upper Price Target     &lt;/th&gt;     &lt;th scope="col"&gt;       Upper % Target     &lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE     &lt;/td&gt;     &lt;td&gt;       Freddie Mac     &lt;/td&gt;     &lt;td&gt;       NYSE     &lt;/td&gt;     &lt;td&gt;       FRE     &lt;/td&gt;     &lt;td&gt;       FRE     &lt;/td&gt;     &lt;td&gt;       FRE     &lt;/td&gt;     &lt;td&gt;       FRE     &lt;/td&gt;     &lt;td&gt;       FRE     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;     &lt;td&gt;       Freddie Mac     &lt;/td&gt;     &lt;td&gt;       NYSE     &lt;/td&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;     &lt;td&gt;       Freddie Mac     &lt;/td&gt;     &lt;td&gt;       NYSE     &lt;/td&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;     &lt;td&gt;       Freddie Mac     &lt;/td&gt;     &lt;td&gt;       NYSE     &lt;/td&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;     &lt;td&gt;       Freddie Mac     &lt;/td&gt;     &lt;td&gt;       NYSE     &lt;/td&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;   &lt;/tr&gt;   &lt;/tbody&gt; &lt;/table&gt; Figure 3.&lt;br/&gt; &lt;br/&gt; If you simply Merge with dt.Merge(dt2), you would get the same result as long as the PrimaryKey is set in dt.  However, without setting the PrimaryKey you get the result in Figure 4.&lt;br/&gt; &lt;br/&gt; &lt;table border="1" cellspacing="0" id="ctl00_ContentPlaceHolder1_GridView2" rules="all" style="border-collapse:collapse"&gt;   &lt;tbody&gt;   &lt;tr&gt;     &lt;th scope="col"&gt;       Symbol     &lt;/th&gt;     &lt;th scope="col"&gt;       Name     &lt;/th&gt;     &lt;th scope="col"&gt;       Exchange     &lt;/th&gt;     &lt;th scope="col"&gt;       EPS Growth     &lt;/th&gt;     &lt;th scope="col"&gt;       Lower Price Target     &lt;/th&gt;     &lt;th scope="col"&gt;       Lower % Target     &lt;/th&gt;     &lt;th scope="col"&gt;       Upper Price Target     &lt;/th&gt;     &lt;th scope="col"&gt;       Upper % Target     &lt;/th&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE     &lt;/td&gt;     &lt;td&gt;       Freddie Mac     &lt;/td&gt;     &lt;td&gt;       NYSE     &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;     &lt;td&gt;       Freddie Mac     &lt;/td&gt;     &lt;td&gt;       NYSE     &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;     &lt;td&gt;       Freddie Mac     &lt;/td&gt;     &lt;td&gt;       NYSE     &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;     &lt;td&gt;       Freddie Mac     &lt;/td&gt;     &lt;td&gt;       NYSE     &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;     &lt;td&gt;       Freddie Mac     &lt;/td&gt;     &lt;td&gt;       NYSE     &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE     &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;       FRE     &lt;/td&gt;     &lt;td&gt;       FRE     &lt;/td&gt;     &lt;td&gt;       FRE     &lt;/td&gt;     &lt;td&gt;       FRE     &lt;/td&gt;     &lt;td&gt;       FRE     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;     &lt;td&gt;       FRE/PB     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;     &lt;td&gt;       FRE/PF     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;     &lt;td&gt;       FRE/PG     &lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;             &lt;/td&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;     &lt;td&gt;       FRE/PH     &lt;/td&gt;   &lt;/tr&gt;   &lt;/tbody&gt; &lt;/table&gt; Figure 4.&lt;br/&gt; &lt;br/&gt; In my implementation I use:&lt;br/&gt; dt.Merge(dt2, false, MissingSchemaAction.Ignore);&lt;br/&gt; This will avoid preserving changes and ignore taking action when there is a missing schema.&lt;br/&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-1159696537345638620?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/1159696537345638620/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=1159696537345638620' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1159696537345638620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/1159696537345638620'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/10/merging-datatables-named-dt-and-dt2.html' title='Using a GridView to make calculations and avoid Database changes by merging DataTables and using PrimaryKey.'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-8792024683080161012</id><published>2007-10-03T17:10:00.000-07:00</published><updated>2007-10-03T17:18:58.776-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C# ADO'/><title type='text'>Loading a GridView into a DataTable and then back to another GridView</title><content type='html'>First, Loading a GridView into a DataTable, dt:&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; initDataTable()&lt;br /&gt;    {&lt;br /&gt;        &lt;br /&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; i = 0;&lt;br /&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; j = 0;&lt;br /&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; totRow = GridView1.Rows.Count;&lt;br /&gt;        &lt;span class="kwrd"&gt;int&lt;/span&gt; totCol = GridView1.Rows[0].Cells.Count;&lt;br /&gt;        &lt;span class="rem"&gt;// Set the table headers&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt;[] arrHeaders = {&lt;span class="str"&gt;"Symbol"&lt;/span&gt;,&lt;span class="str"&gt;"Name"&lt;/span&gt;,&lt;span class="str"&gt;"Exchange"&lt;/span&gt; };&lt;br /&gt;        &lt;span class="rem"&gt;// Get the table headers&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;for&lt;/span&gt; (j = 0; j &amp;lt; totCol; j++)&lt;br /&gt;        {&lt;br /&gt;            &lt;span class="rem"&gt;// The commented line would work if the Gridview had Column HeaderText&lt;/span&gt;&lt;br /&gt;            &lt;span class="rem"&gt;//dt.Columns.Add(new DataColumn(GridView1.Columns[col].HeaderText, typeof(string)));&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;            &lt;span class="rem"&gt;// Instead I use the Headers array, arrHeaders&lt;/span&gt;&lt;br /&gt;            dt.Columns.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; DataColumn(arrHeaders[j].ToString(), &lt;span class="kwrd"&gt;typeof&lt;/span&gt;(&lt;span class="kwrd"&gt;string&lt;/span&gt;)));&lt;br /&gt;        }&lt;br /&gt;        DataRow dr;&lt;br /&gt;        &lt;span class="kwrd"&gt;for&lt;/span&gt; (i = 0; i &amp;lt; totRow; i++)&lt;br /&gt;        {&lt;br /&gt;            dr = &lt;span class="kwrd"&gt;this&lt;/span&gt;.dt.NewRow();            &lt;br /&gt;            &lt;span class="kwrd"&gt;for&lt;/span&gt; (j = 0; j &amp;lt; totCol; j++)&lt;br /&gt;            {&lt;br /&gt;                dr[j] = GridView1.Rows[i].Cells[j].Text;&lt;br /&gt;            }&lt;br /&gt;            &lt;span class="kwrd"&gt;this&lt;/span&gt;.dt.Rows.Add(dr);&lt;br /&gt;        }&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;Then back to another GridView: &lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; fillGridView2()&lt;br /&gt;    {&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (dt.Rows.Count &amp;gt; 0)&lt;br /&gt;        {&lt;br /&gt;            GridView2.DataSource = dt;&lt;br /&gt;            GridView2.DataBind();&lt;br /&gt;        }&lt;br /&gt;        &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            dt.Rows.Add(dt.NewRow());&lt;br /&gt;            GridView2.DataSource = dt;&lt;br /&gt;            GridView2.DataBind();&lt;br /&gt;&lt;br /&gt;            &lt;span class="kwrd"&gt;int&lt;/span&gt; TotalColumns = GridView2.Rows[0].Cells.Count;&lt;br /&gt;            GridView2.Rows[0].Cells.Clear();&lt;br /&gt;            GridView2.Rows[0].Cells.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; TableCell());&lt;br /&gt;            GridView2.Rows[0].Cells[0].ColumnSpan = TotalColumns;&lt;br /&gt;            GridView2.Rows[0].Cells[0].Text = &lt;span class="str"&gt;"No Record Found"&lt;/span&gt;;&lt;br /&gt;        }&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;The no record found code was from this &lt;a href="http://www.aspdotnetcodes.com/GridView_Insert_Edit_Update_Delete.aspx"&gt;link&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-8792024683080161012?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/8792024683080161012/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=8792024683080161012' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8792024683080161012'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/8792024683080161012'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/10/loading-gridview-into-datatable-and.html' title='Loading a GridView into a DataTable and then back to another GridView'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1796403205044129225.post-4369944310538813773</id><published>2007-09-27T17:04:00.002-07:00</published><updated>2007-09-27T17:06:46.484-07:00</updated><title type='text'>Connecting to Kensoft.net SQL Server 2005 database</title><content type='html'>The side note for this is that the database name in Kensoft has an '_' in it, not a '.'.&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;connectionStrings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="rem"&gt;&amp;lt;!--&amp;lt;add name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MyDatabase.mdf;Integrated Security=True; User Instance=True" providerName="System.Data.SqlClient"/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;     --&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;add&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="ConnectionString"&lt;/span&gt; &lt;span class="attr"&gt;connectionString&lt;/span&gt;&lt;span class="kwrd"&gt;="Data Source=mssql2005.kensoft.net;Database=myDatabase;uid=myUserId;pwd=myPassword"&lt;/span&gt; &lt;span class="attr"&gt;providerName&lt;/span&gt;&lt;span class="kwrd"&gt;="System.Data.SqlClient"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;connectionStrings&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1796403205044129225-4369944310538813773?l=techron.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://techron.blogspot.com/feeds/4369944310538813773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=1796403205044129225&amp;postID=4369944310538813773' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/4369944310538813773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1796403205044129225/posts/default/4369944310538813773'/><link rel='alternate' type='text/html' href='http://techron.blogspot.com/2007/09/connecting-to-kensoftnet-sql-server.html' title='Connecting to Kensoft.net SQL Server 2005 database'/><author><name>techron</name><uri>http://www.blogger.com/profile/16417760065784178648</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry></feed>
