<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>ProgramGood.Net - ASP.NET Best Practise</title>
    <link>http://www.programgood.net/</link>
    <description>The journey to becoming a great programmer</description>
    <language>en-us</language>
    <copyright>Dave Mateer</copyright>
    <lastBuildDate>Wed, 11 Aug 2010 02:10:41 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.2.8279.16125</generator>
    <managingEditor>davemateer@gmail.com</managingEditor>
    <webMaster>davemateer@gmail.com</webMaster>
    <item>
      <trackback:ping>http://www.programgood.net/Trackback.aspx?guid=8d3586d1-988c-42fb-bfb0-1ce105f0af32</trackback:ping>
      <pingback:server>http://www.programgood.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.programgood.net/PermaLink,guid,8d3586d1-988c-42fb-bfb0-1ce105f0af32.aspx</pingback:target>
      <dc:creator>Dave Mateer</dc:creator>
      <wfw:comment>http://www.programgood.net/CommentView,guid,8d3586d1-988c-42fb-bfb0-1ce105f0af32.aspx</wfw:comment>
      <wfw:commentRss>http://www.programgood.net/SyndicationService.asmx/GetEntryCommentsRss?guid=8d3586d1-988c-42fb-bfb0-1ce105f0af32</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://blog.hmobius.com/post/2010/02/17/ASPNET-40-Part-4-Config-Transformation-Files.aspx">http://blog.hmobius.com/post/2010/02/17/ASPNET-40-Part-4-Config-Transformation-Files.aspx</a>
        </p>
        <p>
A very good blog on transforms
</p>
        <p>
          <a href="http://www.programgood.net/content/binary/WindowsLiveWriter/Web.debug.config_C63C/image_2.png">
            <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.programgood.net/content/binary/WindowsLiveWriter/Web.debug.config_C63C/image_thumb.png" width="190" height="163" />
          </a>
        </p>
        <p>
Am transforming Connection strings now and Smtp
</p>
        <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
          <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">&lt;connectionStrings&gt;<br />
&lt;add name=<span style="color: #006080">"Sitefinity"</span> connectionString=<span style="color: #006080">"Data
Source=mssql1.blah.nz;Initial Catalog=secret;Persist Security Info=True;User ID=user;Password=password!"</span><br />
providerName=<span style="color: #006080">"System.Data.SqlClient"</span><br />
xdt:Transform=<span style="color: #006080">"SetAttributes"</span> xdt:Locator=<span style="color: #006080">"Match(name)"</span> /&gt;<br />
&lt;/connectionStrings&gt;</pre>
          <br />
        </div>
        <p>
smtp:
</p>
        <div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
          <pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">&lt;system.net&gt;<br />
&lt;mailSettings&gt;<br />
&lt;smtp from=<span style="color: #006080">"dave@blah.co.nz"</span>&gt;<br />
&lt;network port=<span style="color: #006080">"25"</span> host=<span style="color: #006080">"mail.blah.co.nz"</span> userName=<span style="color: #006080">"user@blah.co.nz"</span> password=<span style="color: #006080">"secret"</span> xdt:Transform=<span style="color: #006080">"SetAttributes"</span> xdt:Locator=<span style="color: #006080">"Match(port)"</span> /&gt;<br />
&lt;/smtp&gt;<br />
&lt;/mailSettings&gt;<br />
&lt;/system.net&gt;</pre>
          <br />
        </div>
        <img width="0" height="0" src="http://www.programgood.net/aggbug.ashx?id=8d3586d1-988c-42fb-bfb0-1ce105f0af32" />
      </body>
      <title>Web.debug.config</title>
      <guid isPermaLink="false">http://www.programgood.net/PermaLink,guid,8d3586d1-988c-42fb-bfb0-1ce105f0af32.aspx</guid>
      <link>http://www.programgood.net/2010/08/11/Webdebugconfig.aspx</link>
      <pubDate>Wed, 11 Aug 2010 02:10:41 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://blog.hmobius.com/post/2010/02/17/ASPNET-40-Part-4-Config-Transformation-Files.aspx"&gt;http://blog.hmobius.com/post/2010/02/17/ASPNET-40-Part-4-Config-Transformation-Files.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
A very good blog on transforms
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.programgood.net/content/binary/WindowsLiveWriter/Web.debug.config_C63C/image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.programgood.net/content/binary/WindowsLiveWriter/Web.debug.config_C63C/image_thumb.png" width="190" height="163" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Am transforming Connection strings now and Smtp
&lt;/p&gt;
&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&amp;lt;connectionStrings&amp;gt;&lt;br /&gt;
&amp;lt;add name=&lt;span style="color: #006080"&gt;&amp;quot;Sitefinity&amp;quot;&lt;/span&gt; connectionString=&lt;span style="color: #006080"&gt;&amp;quot;Data
Source=mssql1.blah.nz;Initial Catalog=secret;Persist Security Info=True;User ID=user;Password=password!&amp;quot;&lt;/span&gt;
&lt;br /&gt;
providerName=&lt;span style="color: #006080"&gt;&amp;quot;System.Data.SqlClient&amp;quot;&lt;/span&gt;
&lt;br /&gt;
xdt:Transform=&lt;span style="color: #006080"&gt;&amp;quot;SetAttributes&amp;quot;&lt;/span&gt; xdt:Locator=&lt;span style="color: #006080"&gt;&amp;quot;Match(name)&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;
&amp;lt;/connectionStrings&amp;gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;p&gt;
smtp:
&lt;/p&gt;
&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&amp;lt;system.net&amp;gt;&lt;br /&gt;
&amp;lt;mailSettings&amp;gt;&lt;br /&gt;
&amp;lt;smtp from=&lt;span style="color: #006080"&gt;&amp;quot;dave@blah.co.nz&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;
&amp;lt;network port=&lt;span style="color: #006080"&gt;&amp;quot;25&amp;quot;&lt;/span&gt; host=&lt;span style="color: #006080"&gt;&amp;quot;mail.blah.co.nz&amp;quot;&lt;/span&gt; userName=&lt;span style="color: #006080"&gt;&amp;quot;user@blah.co.nz&amp;quot;&lt;/span&gt; password=&lt;span style="color: #006080"&gt;&amp;quot;secret&amp;quot;&lt;/span&gt; xdt:Transform=&lt;span style="color: #006080"&gt;&amp;quot;SetAttributes&amp;quot;&lt;/span&gt; xdt:Locator=&lt;span style="color: #006080"&gt;&amp;quot;Match(port)&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;
&amp;lt;/smtp&amp;gt;&lt;br /&gt;
&amp;lt;/mailSettings&amp;gt;&lt;br /&gt;
&amp;lt;/system.net&amp;gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://www.programgood.net/aggbug.ashx?id=8d3586d1-988c-42fb-bfb0-1ce105f0af32" /&gt;</description>
      <comments>http://www.programgood.net/CommentView,guid,8d3586d1-988c-42fb-bfb0-1ce105f0af32.aspx</comments>
      <category>ASP.NET Best Practise</category>
      <category>SiteFinity</category>
    </item>
    <item>
      <trackback:ping>http://www.programgood.net/Trackback.aspx?guid=352f100b-df85-4ca2-aa5a-14d32e66ab1a</trackback:ping>
      <pingback:server>http://www.programgood.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.programgood.net/PermaLink,guid,352f100b-df85-4ca2-aa5a-14d32e66ab1a.aspx</pingback:target>
      <dc:creator>Dave Mateer</dc:creator>
      <wfw:comment>http://www.programgood.net/CommentView,guid,352f100b-df85-4ca2-aa5a-14d32e66ab1a.aspx</wfw:comment>
      <wfw:commentRss>http://www.programgood.net/SyndicationService.asmx/GetEntryCommentsRss?guid=352f100b-df85-4ca2-aa5a-14d32e66ab1a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">I know I've skipped a few chapters.. but
hey.. who is perfect?  Sometimes, it is good to get to some concrete results
to give some pespective.<br /><br />
After months of playing with code (why do things always take longer than you think..?),
and having a blast, I've now forgotton everything I know about asp.net.  So time
to do some spikes.<br /><br />
Here is a super simple reminder of asp.net syntax and simple events:<br /><br />
Default.aspx (\code\tddBook\SimpleAspSpike)<br /><br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;">&lt;%@
Page Language=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"C#"</span> AutoEventWireup=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"true"</span> CodeBehind=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Default.aspx.cs"</span> Inherits=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"WebSite2testWebProj._Default"</span> %&gt;
&lt;!DOCTYPE html PUBLIC <span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"-//W3C//DTD
XHTML 1.0 Transitional//EN"</span><span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span>&gt;
&lt;html xmlns=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"http://www.w3.org/1999/xhtml"</span>&gt;
&lt;head id=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Head1"</span> runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span>&gt;
&lt;title&gt;Untitled Page&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form id=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"form2"</span> runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span>&gt;
&lt;div&gt; hello world from html&lt;br /&gt; &lt;%= <span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Hello
from asp.net"</span> %&gt; &lt;br /&gt; This <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">is</span> a
label: &lt;asp:Label ID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"label1"</span> runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span> /&gt;
&lt;br /&gt; The time <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">is</span>:
&lt;%= System.DateTime.Now.ToLongTimeString()%&gt; &lt;br /&gt; This <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">is</span> a
textbox: &lt;asp:TextBox runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span> ID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"textbox1"</span> /&gt;&lt;br
/&gt; A button: &lt;asp:Button runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span> ID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"button1"</span> Text=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"press
me"</span> onclick=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"button1_Click"</span> /&gt;&lt;br
/&gt; Label2 <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">is</span> here:
&lt;asp:Label ID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"label2"</span> runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span> /&gt;&lt;br
/&gt; asp.net uses viewstate.. so the button <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">is</span> just
a submit button, which then goes back to the server, refreshes the page with the <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">new</span> data <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">in</span> the
label2 label. &lt;br /&gt; &lt;/div&gt; Autopostback <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">is</span> set <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">in</span> the
following DropDownList (server control)... makes contact with the server each time
an item <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">is</span> selected..
which we can use to wire up an <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">event</span>..onselectedindexchanged&lt;br
/&gt; &lt;asp:DropDownList runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span> ID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"GreetList"</span> AutoPostBack=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"true"</span> onselectedindexchanged=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"GreetList_SelectedIndexChanged"</span>&gt;
&lt;asp:ListItem Value=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"no
one"</span>&gt;No one&lt;/asp:ListItem&gt; &lt;asp:ListItem Value=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"world"</span>&gt;World&lt;/asp:ListItem&gt;
&lt;asp:ListItem Value=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"universe"</span>&gt;Universe&lt;/asp:ListItem&gt;
&lt;/asp:DropDownList&gt;&lt;br /&gt; Label3: &lt;asp:Label ID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"label3"</span> runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span> /&gt;
&lt;br /&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt;</span></pre><br />
And the Default.aspx.cs<br /><br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">using</span> System; <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">using</span> System.Web.UI; <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">namespace</span> WebSite2testWebProj
{ <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">public</span> partial <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">class</span> _Default
: Page { <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">protected</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">void</span> Page_Load(<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">object</span> sender,
EventArgs e) { Response.Write(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Hello
from Page_Load in codebehind"</span>); label1.Text <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Hello
from the codebehind into a label"</span>; textbox1.Text <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Textbox
from codebehind"</span>; } <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">protected</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">void</span> button1_Click(<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">object</span> sender,
EventArgs e) { label2.Text <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"button
pressed"</span>; } <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">protected</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">void</span> GreetList_SelectedIndexChanged(<span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">object</span> sender,
EventArgs e) { label3.Text <span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">=</span><span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Hello,
"</span><span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;">+</span> GreetList.SelectedValue;
} } }</span></pre><br />
Ok, looking good so far.<br /><br />
Difference between <b>CodeBehind and CodeFile</b><br /><br /><b>WebSite or Web Application Project?</b><br />
http://www.dotnetspider.com/resources/1520-Difference-between-web-site-web-application.aspx<br /><br />
WebSite is really simple, with no project file.  Web Application Project has
a project file.<br /><br />
Found that remembering how to access databases isn't too easy:<br /><br />
looking at old project:<br />
http://treasuresprint.blogspot.com<br /><br />
Realised I didn't put up the sourcecode at the time, and have managed to find it on
my laptop:<br /><br /><br /><b>Connecting to and displaying data from a DB very easily:</b><br /><br />
Deafult.aspx (\code\tddBook\DBConnectySpike)<br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;">&lt;form
id=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"form1"</span> runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span>&gt;
&lt;div&gt; &lt;asp:SqlDataSource ID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"SqlDataSource1"</span> runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span> ConnectionString=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"&lt;%$
ConnectionStrings:TreasureConnectionString %&gt;"</span> SelectCommand=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"SELECT
[StuffId], [Description] FROM [Stuff]"</span>&gt;&lt;/asp:SqlDataSource&gt; &lt;br
/&gt; &lt;br /&gt; <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">this</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">is</span> a
gridview&amp;nbsp;&lt;asp:GridView ID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"GridView1"</span> runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span> AutoGenerateColumns=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"False"</span> DataKeyNames=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"StuffId"</span> DataSourceID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"SqlDataSource1"</span>&gt;
&lt;Columns&gt; &lt;asp:BoundField DataField=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"StuffId"</span> HeaderText=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"StuffId"</span> InsertVisible=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"False"</span> ReadOnly=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"True"</span> SortExpression=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"StuffId"</span> /&gt;
&lt;asp:BoundField DataField=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Description"</span> HeaderText=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Description"</span> SortExpression=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Description"</span> /&gt;
&lt;/Columns&gt; &lt;/asp:GridView&gt; &lt;br /&gt; <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">this</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">is</span> a
datalist&lt;br /&gt; &lt;br /&gt; &lt;asp:DataList ID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"DataList1"</span> runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span> DataSourceID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"SqlDataSource1"</span> &gt;
&lt;ItemTemplate&gt; &lt;asp:Literal ID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Literal2"</span> runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span> Text=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Description:"</span>&gt;&lt;/asp:Literal&gt;
&lt;asp:Literal ID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Literal1"</span> runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span> Text='&lt;%#
Eval(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Description"</span>)
%&gt;'&gt;&lt;/asp:Literal&gt; &lt;/ItemTemplate&gt; &lt;EditItemTemplate&gt; &lt;asp:Literal
ID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Literal2"</span> runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span> Text=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Description:"</span>&gt;&lt;/asp:Literal&gt;
&lt;asp:TextBox ID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"TextBox1"</span> runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span> Text='&lt;%#
Eval(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Description"</span>)
%&gt;' Width=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"208px"</span>&gt;&lt;/asp:TextBox&gt;
&lt;/EditItemTemplate&gt; &lt;/asp:DataList&gt;&lt;br /&gt; &lt;br /&gt; <span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">this</span><span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;">is</span> a
details view&lt;/div&gt; &lt;asp:DetailsView ID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"DetailsView1"</span> runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span> AutoGenerateRows=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"False"</span> CellPadding=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"4"</span> DataKeyNames=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"StuffId"</span> DataSourceID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"SqlDataSource1"</span> ForeColor=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"#333333"</span> GridLines=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"None"</span> Height=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"50px"</span> Width=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"341px"</span>&gt;
&lt;FooterStyle BackColor=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"#507CD1"</span> Font-Bold=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"True"</span> ForeColor=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"White"</span> /&gt;
&lt;CommandRowStyle BackColor=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"#D1DDF1"</span> Font-Bold=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"True"</span> /&gt;
&lt;EditRowStyle BackColor=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"#2461BF"</span> /&gt;
&lt;RowStyle BackColor=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"#EFF3FB"</span> /&gt;
&lt;PagerStyle BackColor=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"#2461BF"</span> ForeColor=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"White"</span> HorizontalAlign=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Center"</span> /&gt;
&lt;Fields&gt; &lt;asp:BoundField DataField=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"StuffId"</span> HeaderText=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"StuffId"</span> InsertVisible=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"False"</span> ReadOnly=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"True"</span> SortExpression=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"StuffId"</span> /&gt;
&lt;asp:BoundField DataField=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Description"</span> HeaderText=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Description"</span> SortExpression=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Description"</span> /&gt;
&lt;/Fields&gt; &lt;FieldHeaderStyle BackColor=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"#DEE8F5"</span> Font-Bold=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"True"</span> /&gt;
&lt;HeaderStyle BackColor=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"#507CD1"</span> Font-Bold=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"True"</span> ForeColor=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"White"</span> /&gt;
&lt;AlternatingRowStyle BackColor=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"White"</span> /&gt;
&lt;/asp:DetailsView&gt; &lt;br /&gt; &lt;br /&gt; &lt;/form&gt;</span></pre>And in
the web.config:<br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;">&lt;connectionStrings&gt;
&lt;add name=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"TreasureConnectionString"</span> connectionString=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Data
Source=localhost;Initial Catalog=Treasure;Persist Security Info=True;User ID=dave;Password=letmein"</span> providerName=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"System.Data.SqlClient"</span>/&gt;
    &lt;/connectionStrings&gt;</span></pre>So it should come out
like this:<br /><br /><p></p><img src="http://www.programgood.net/content/binary/screen123456789101112131415.gif" border="0" /><br /><b>Thoughts</b><br />
ASP.NET offers some controls to make life 'easier' such as databinding, edit, deleting,
sorting on the gridview:  All pretty powerful for RAD, however for testable apps..
am not sure this is the way.  Or perhaps other Grid controls like Telerik are
better.  Maybe best to Keep it Simple.<br /><br />
Ideally we want testable code, with a thin layer of UI code on top.<br /><pre><span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;">A
gridview with update &lt;asp:SqlDataSource ID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"SqlDataSource2"</span> runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span> ConnectionString=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"&lt;%$
ConnectionStrings:TreasureConnectionString %&gt;"</span> SelectCommand=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"SELECT
[StuffId], [Description] FROM [Stuff]"</span> UpdateCommand=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"UPDATE
Stuff SET Description=@Description WHERE StuffID=@StuffID"</span>&gt; &lt;/asp:SqlDataSource&gt;
&lt;asp:GridView ID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"GridView2"</span> runat=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"server"</span> AutoGenerateColumns=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"False"</span> DataKeyNames=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"StuffId"</span> AutoGenerateEditButton=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"true"</span> DataSourceID=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"SqlDataSource2"</span>&gt;
&lt;Columns&gt; &lt;asp:BoundField DataField=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"StuffId"</span> HeaderText=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"StuffId"</span>/&gt;
&lt;asp:BoundField DataField=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Description"</span> HeaderText=<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Description"</span>/&gt;
&lt;/Columns&gt; &lt;/asp:GridView&gt;</span></pre><img src="http://www.programgood.net/content/binary/screen12345678910111213141516.gif" border="0" /><br /><br />
And DropDownList / TextBox common usage:<br /><br /><br /><img src="http://www.programgood.net/content/binary/screen1234567891011121314151617.gif" border="0" /><br /><br />
This is all in the DB spike source code here:<br /><a href="http://www.programgood.net/content/binary/DBConnectSpike.zip">DBConnectSpike.zip
(15.17 KB)</a><br /><br />
Data Control Summary<br />
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/default.aspx<br /><br />
Gridview - the classic Grid..edit, delete, sort, page.  Takes advantage of DataSource
controls<br />
DataList - items in a repeating list<br />
DetailsView - typically used.. if a gridview item is selected, the detailsView is
displayed to edit.<br />
FormView - same as above but with no built in template.<br />
Repeater - has no built in layout or styles.  No column layout. No Edit/Del<br /><br />
Going through the SearchPage.aspx.. trying to get any of this application to compile. 
Have got source from book.. however..  good practise to chop code and and try
and work through.  Hmm - sometimes better to revert back to compiling code in
source control.<br /><br />
This project is in need of refactoring... too complex currently.  Would like
to 'defactor' for simplicity, then put some patterns back in.  Webservice would
be first to go, and use POCOs.  XSD definition for DTOs would go as well, with
simple objects as definitions.  DAL I'd like to take out Datasets and use a manual
DAL.<br /><br />
Most important thing is to get it working.  Good thing about this project so
far, is that it is testable at every level.<br /><img width="0" height="0" src="http://www.programgood.net/aggbug.ashx?id=352f100b-df85-4ca2-aa5a-14d32e66ab1a" /></body>
      <title>ASP.NET Web Client Front End - Ch12</title>
      <guid isPermaLink="false">http://www.programgood.net/PermaLink,guid,352f100b-df85-4ca2-aa5a-14d32e66ab1a.aspx</guid>
      <link>http://www.programgood.net/2009/11/04/ASPNETWebClientFrontEndCh12.aspx</link>
      <pubDate>Wed, 04 Nov 2009 21:36:27 GMT</pubDate>
      <description>I know I've skipped a few chapters.. but hey.. who is perfect?&amp;nbsp;
Sometimes, it is good to get to some concrete results to give some
pespective.&lt;br&gt;
&lt;br&gt;
After months of playing with code (why do things always take longer than you think..?),
and having a blast, I've now forgotton everything I know about asp.net.&amp;nbsp; So time
to do some spikes.&lt;br&gt;
&lt;br&gt;
Here is a super simple reminder of asp.net syntax and simple events:&lt;br&gt;
&lt;br&gt;
Default.aspx (\code\tddBook\SimpleAspSpike)&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;&amp;lt;%@
Page Language=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"C#"&lt;/span&gt; AutoEventWireup=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"true"&lt;/span&gt; CodeBehind=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Default.aspx.cs"&lt;/span&gt; Inherits=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"WebSite2testWebProj._Default"&lt;/span&gt; %&amp;gt;
&amp;lt;!DOCTYPE html PUBLIC &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"-//W3C//DTD
XHTML 1.0 Transitional//EN"&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&lt;/span&gt;&amp;gt;
&amp;lt;html xmlns=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"http://www.w3.org/1999/xhtml"&lt;/span&gt;&amp;gt;
&amp;lt;head id=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Head1"&lt;/span&gt; runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt;&amp;gt;
&amp;lt;title&amp;gt;Untitled Page&amp;lt;/title&amp;gt; &amp;lt;/head&amp;gt; &amp;lt;body&amp;gt; &amp;lt;form id=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"form2"&lt;/span&gt; runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt;&amp;gt;
&amp;lt;div&amp;gt; hello world from html&amp;lt;br /&amp;gt; &amp;lt;%= &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Hello
from asp.net"&lt;/span&gt; %&amp;gt; &amp;lt;br /&amp;gt; This &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;is&lt;/span&gt; a
label: &amp;lt;asp:Label ID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"label1"&lt;/span&gt; runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt; /&amp;gt;
&amp;lt;br /&amp;gt; The time &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;is&lt;/span&gt;:
&amp;lt;%= System.DateTime.Now.ToLongTimeString()%&amp;gt; &amp;lt;br /&amp;gt; This &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;is&lt;/span&gt; a
textbox: &amp;lt;asp:TextBox runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt; ID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"textbox1"&lt;/span&gt; /&amp;gt;&amp;lt;br
/&amp;gt; A button: &amp;lt;asp:Button runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt; ID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"button1"&lt;/span&gt; Text=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"press
me"&lt;/span&gt; onclick=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"button1_Click"&lt;/span&gt; /&amp;gt;&amp;lt;br
/&amp;gt; Label2 &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;is&lt;/span&gt; here:
&amp;lt;asp:Label ID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"label2"&lt;/span&gt; runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt; /&amp;gt;&amp;lt;br
/&amp;gt; asp.net uses viewstate.. so the button &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;is&lt;/span&gt; just
a submit button, which then goes back to the server, refreshes the page with the &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;new&lt;/span&gt; data &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;in&lt;/span&gt; the
label2 label. &amp;lt;br /&amp;gt; &amp;lt;/div&amp;gt; Autopostback &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;is&lt;/span&gt; set &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;in&lt;/span&gt; the
following DropDownList (server control)... makes contact with the server each time
an item &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;is&lt;/span&gt; selected..
which we can use to wire up an &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;event&lt;/span&gt;..onselectedindexchanged&amp;lt;br
/&amp;gt; &amp;lt;asp:DropDownList runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt; ID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"GreetList"&lt;/span&gt; AutoPostBack=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"true"&lt;/span&gt; onselectedindexchanged=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"GreetList_SelectedIndexChanged"&lt;/span&gt;&amp;gt;
&amp;lt;asp:ListItem Value=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"no
one"&lt;/span&gt;&amp;gt;No one&amp;lt;/asp:ListItem&amp;gt; &amp;lt;asp:ListItem Value=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"world"&lt;/span&gt;&amp;gt;World&amp;lt;/asp:ListItem&amp;gt;
&amp;lt;asp:ListItem Value=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"universe"&lt;/span&gt;&amp;gt;Universe&amp;lt;/asp:ListItem&amp;gt;
&amp;lt;/asp:DropDownList&amp;gt;&amp;lt;br /&amp;gt; Label3: &amp;lt;asp:Label ID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"label3"&lt;/span&gt; runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt; /&amp;gt;
&amp;lt;br /&amp;gt; &amp;lt;/form&amp;gt; &amp;lt;/body&amp;gt; &amp;lt;/html&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;br&gt;
And the Default.aspx.cs&lt;br&gt;
&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;using&lt;/span&gt; System; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;using&lt;/span&gt; System.Web.UI; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;namespace&lt;/span&gt; WebSite2testWebProj
{ &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; partial &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;class&lt;/span&gt; _Default
: Page { &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;protected&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;object&lt;/span&gt; sender,
EventArgs e) { Response.Write(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Hello
from Page_Load in codebehind"&lt;/span&gt;); label1.Text &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Hello
from the codebehind into a label"&lt;/span&gt;; textbox1.Text &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Textbox
from codebehind"&lt;/span&gt;; } &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;protected&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; button1_Click(&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;object&lt;/span&gt; sender,
EventArgs e) { label2.Text &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"button
pressed"&lt;/span&gt;; } &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;protected&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; GreetList_SelectedIndexChanged(&lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;object&lt;/span&gt; sender,
EventArgs e) { label3.Text &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Hello,
"&lt;/span&gt; &lt;span style="color: Red; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;+&lt;/span&gt; GreetList.SelectedValue;
} } }&lt;/span&gt;&lt;/pre&gt;
&lt;br&gt;
Ok, looking good so far.&lt;br&gt;
&lt;br&gt;
Difference between &lt;b&gt;CodeBehind and CodeFile&lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
&lt;b&gt;WebSite or Web Application Project?&lt;/b&gt;
&lt;br&gt;
http://www.dotnetspider.com/resources/1520-Difference-between-web-site-web-application.aspx&lt;br&gt;
&lt;br&gt;
WebSite is really simple, with no project file.&amp;nbsp; Web Application Project has
a project file.&lt;br&gt;
&lt;br&gt;
Found that remembering how to access databases isn't too easy:&lt;br&gt;
&lt;br&gt;
looking at old project:&lt;br&gt;
http://treasuresprint.blogspot.com&lt;br&gt;
&lt;br&gt;
Realised I didn't put up the sourcecode at the time, and have managed to find it on
my laptop:&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;b&gt;Connecting to and displaying data from a DB very easily:&lt;/b&gt;
&lt;br&gt;
&lt;br&gt;
Deafult.aspx (\code\tddBook\DBConnectySpike)&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;&amp;lt;form
id=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"form1"&lt;/span&gt; runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt;&amp;gt;
&amp;lt;div&amp;gt; &amp;lt;asp:SqlDataSource ID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"SqlDataSource1"&lt;/span&gt; runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt; ConnectionString=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"&amp;lt;%$
ConnectionStrings:TreasureConnectionString %&amp;gt;"&lt;/span&gt; SelectCommand=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"SELECT
[StuffId], [Description] FROM [Stuff]"&lt;/span&gt;&amp;gt;&amp;lt;/asp:SqlDataSource&amp;gt; &amp;lt;br
/&amp;gt; &amp;lt;br /&amp;gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;this&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;is&lt;/span&gt; a
gridview&amp;amp;nbsp;&amp;lt;asp:GridView ID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"GridView1"&lt;/span&gt; runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt; AutoGenerateColumns=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"False"&lt;/span&gt; DataKeyNames=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"StuffId"&lt;/span&gt; DataSourceID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"SqlDataSource1"&lt;/span&gt;&amp;gt;
&amp;lt;Columns&amp;gt; &amp;lt;asp:BoundField DataField=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"StuffId"&lt;/span&gt; HeaderText=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"StuffId"&lt;/span&gt; InsertVisible=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"False"&lt;/span&gt; ReadOnly=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"True"&lt;/span&gt; SortExpression=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"StuffId"&lt;/span&gt; /&amp;gt;
&amp;lt;asp:BoundField DataField=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Description"&lt;/span&gt; HeaderText=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Description"&lt;/span&gt; SortExpression=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Description"&lt;/span&gt; /&amp;gt;
&amp;lt;/Columns&amp;gt; &amp;lt;/asp:GridView&amp;gt; &amp;lt;br /&amp;gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;this&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;is&lt;/span&gt; a
datalist&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; &amp;lt;asp:DataList ID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"DataList1"&lt;/span&gt; runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt; DataSourceID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"SqlDataSource1"&lt;/span&gt; &amp;gt;
&amp;lt;ItemTemplate&amp;gt; &amp;lt;asp:Literal ID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Literal2"&lt;/span&gt; runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt; Text=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Description:"&lt;/span&gt;&amp;gt;&amp;lt;/asp:Literal&amp;gt;
&amp;lt;asp:Literal ID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Literal1"&lt;/span&gt; runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt; Text='&amp;lt;%#
Eval(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Description"&lt;/span&gt;)
%&amp;gt;'&amp;gt;&amp;lt;/asp:Literal&amp;gt; &amp;lt;/ItemTemplate&amp;gt; &amp;lt;EditItemTemplate&amp;gt; &amp;lt;asp:Literal
ID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Literal2"&lt;/span&gt; runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt; Text=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Description:"&lt;/span&gt;&amp;gt;&amp;lt;/asp:Literal&amp;gt;
&amp;lt;asp:TextBox ID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"TextBox1"&lt;/span&gt; runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt; Text='&amp;lt;%#
Eval(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Description"&lt;/span&gt;)
%&amp;gt;' Width=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"208px"&lt;/span&gt;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;
&amp;lt;/EditItemTemplate&amp;gt; &amp;lt;/asp:DataList&amp;gt;&amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;this&lt;/span&gt; &lt;span style="color: Blue; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;is&lt;/span&gt; a
details view&amp;lt;/div&amp;gt; &amp;lt;asp:DetailsView ID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"DetailsView1"&lt;/span&gt; runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt; AutoGenerateRows=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"False"&lt;/span&gt; CellPadding=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"4"&lt;/span&gt; DataKeyNames=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"StuffId"&lt;/span&gt; DataSourceID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"SqlDataSource1"&lt;/span&gt; ForeColor=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"#333333"&lt;/span&gt; GridLines=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"None"&lt;/span&gt; Height=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"50px"&lt;/span&gt; Width=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"341px"&lt;/span&gt;&amp;gt;
&amp;lt;FooterStyle BackColor=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"#507CD1"&lt;/span&gt; Font-Bold=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"True"&lt;/span&gt; ForeColor=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"White"&lt;/span&gt; /&amp;gt;
&amp;lt;CommandRowStyle BackColor=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"#D1DDF1"&lt;/span&gt; Font-Bold=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"True"&lt;/span&gt; /&amp;gt;
&amp;lt;EditRowStyle BackColor=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"#2461BF"&lt;/span&gt; /&amp;gt;
&amp;lt;RowStyle BackColor=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"#EFF3FB"&lt;/span&gt; /&amp;gt;
&amp;lt;PagerStyle BackColor=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"#2461BF"&lt;/span&gt; ForeColor=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"White"&lt;/span&gt; HorizontalAlign=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Center"&lt;/span&gt; /&amp;gt;
&amp;lt;Fields&amp;gt; &amp;lt;asp:BoundField DataField=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"StuffId"&lt;/span&gt; HeaderText=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"StuffId"&lt;/span&gt; InsertVisible=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"False"&lt;/span&gt; ReadOnly=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"True"&lt;/span&gt; SortExpression=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"StuffId"&lt;/span&gt; /&amp;gt;
&amp;lt;asp:BoundField DataField=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Description"&lt;/span&gt; HeaderText=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Description"&lt;/span&gt; SortExpression=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Description"&lt;/span&gt; /&amp;gt;
&amp;lt;/Fields&amp;gt; &amp;lt;FieldHeaderStyle BackColor=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"#DEE8F5"&lt;/span&gt; Font-Bold=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"True"&lt;/span&gt; /&amp;gt;
&amp;lt;HeaderStyle BackColor=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"#507CD1"&lt;/span&gt; Font-Bold=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"True"&lt;/span&gt; ForeColor=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"White"&lt;/span&gt; /&amp;gt;
&amp;lt;AlternatingRowStyle BackColor=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"White"&lt;/span&gt; /&amp;gt;
&amp;lt;/asp:DetailsView&amp;gt; &amp;lt;br /&amp;gt; &amp;lt;br /&amp;gt; &amp;lt;/form&amp;gt;&lt;/span&gt;&lt;/pre&gt;And in
the web.config:&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;&amp;lt;connectionStrings&amp;gt;
&amp;lt;add name=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"TreasureConnectionString"&lt;/span&gt; connectionString=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Data
Source=localhost;Initial Catalog=Treasure;Persist Security Info=True;User ID=dave;Password=letmein"&lt;/span&gt; providerName=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"System.Data.SqlClient"&lt;/span&gt;/&amp;gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;lt;/connectionStrings&amp;gt;&lt;/span&gt;&lt;/pre&gt;So it should come out
like this:&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img src="http://www.programgood.net/content/binary/screen123456789101112131415.gif" border="0"&gt;
&lt;br&gt;
&lt;b&gt;Thoughts&lt;/b&gt;
&lt;br&gt;
ASP.NET offers some controls to make life 'easier' such as databinding, edit, deleting,
sorting on the gridview:&amp;nbsp; All pretty powerful for RAD, however for testable apps..
am not sure this is the way.&amp;nbsp; Or perhaps other Grid controls like Telerik are
better.&amp;nbsp; Maybe best to Keep it Simple.&lt;br&gt;
&lt;br&gt;
Ideally we want testable code, with a thin layer of UI code on top.&lt;br&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: Transparent; font-family: Courier New; font-size: 11px;"&gt;A
gridview with update &amp;lt;asp:SqlDataSource ID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"SqlDataSource2"&lt;/span&gt; runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt; ConnectionString=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"&amp;lt;%$
ConnectionStrings:TreasureConnectionString %&amp;gt;"&lt;/span&gt; SelectCommand=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"SELECT
[StuffId], [Description] FROM [Stuff]"&lt;/span&gt; UpdateCommand=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"UPDATE
Stuff SET Description=@Description WHERE StuffID=@StuffID"&lt;/span&gt;&amp;gt; &amp;lt;/asp:SqlDataSource&amp;gt;
&amp;lt;asp:GridView ID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"GridView2"&lt;/span&gt; runat=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"server"&lt;/span&gt; AutoGenerateColumns=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"False"&lt;/span&gt; DataKeyNames=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"StuffId"&lt;/span&gt; AutoGenerateEditButton=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"true"&lt;/span&gt; DataSourceID=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"SqlDataSource2"&lt;/span&gt;&amp;gt;
&amp;lt;Columns&amp;gt; &amp;lt;asp:BoundField DataField=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"StuffId"&lt;/span&gt; HeaderText=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"StuffId"&lt;/span&gt;/&amp;gt;
&amp;lt;asp:BoundField DataField=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Description"&lt;/span&gt; HeaderText=&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Description"&lt;/span&gt;/&amp;gt;
&amp;lt;/Columns&amp;gt; &amp;lt;/asp:GridView&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;img src="http://www.programgood.net/content/binary/screen12345678910111213141516.gif" border="0"&gt;
&lt;br&gt;
&lt;br&gt;
And DropDownList / TextBox common usage:&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;img src="http://www.programgood.net/content/binary/screen1234567891011121314151617.gif" border="0"&gt;
&lt;br&gt;
&lt;br&gt;
This is all in the DB spike source code here:&lt;br&gt;
&lt;a href="http://www.programgood.net/content/binary/DBConnectSpike.zip"&gt;DBConnectSpike.zip
(15.17 KB)&lt;/a&gt;
&lt;br&gt;
&lt;br&gt;
Data Control Summary&lt;br&gt;
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/default.aspx&lt;br&gt;
&lt;br&gt;
Gridview - the classic Grid..edit, delete, sort, page.&amp;nbsp; Takes advantage of DataSource
controls&lt;br&gt;
DataList - items in a repeating list&lt;br&gt;
DetailsView - typically used.. if a gridview item is selected, the detailsView is
displayed to edit.&lt;br&gt;
FormView - same as above but with no built in template.&lt;br&gt;
Repeater - has no built in layout or styles.&amp;nbsp; No column layout. No Edit/Del&lt;br&gt;
&lt;br&gt;
Going through the SearchPage.aspx.. trying to get any of this application to compile.&amp;nbsp;
Have got source from book.. however..&amp;nbsp; good practise to chop code and and try
and work through.&amp;nbsp; Hmm - sometimes better to revert back to compiling code in
source control.&lt;br&gt;
&lt;br&gt;
This project is in need of refactoring... too complex currently.&amp;nbsp; Would like
to 'defactor' for simplicity, then put some patterns back in.&amp;nbsp; Webservice would
be first to go, and use POCOs.&amp;nbsp; XSD definition for DTOs would go as well, with
simple objects as definitions.&amp;nbsp; DAL I'd like to take out Datasets and use a manual
DAL.&lt;br&gt;
&lt;br&gt;
Most important thing is to get it working.&amp;nbsp; Good thing about this project so
far, is that it is testable at every level.&lt;br&gt;
&lt;img width="0" height="0" src="http://www.programgood.net/aggbug.ashx?id=352f100b-df85-4ca2-aa5a-14d32e66ab1a" /&gt;</description>
      <comments>http://www.programgood.net/CommentView,guid,352f100b-df85-4ca2-aa5a-14d32e66ab1a.aspx</comments>
      <category>ASP.NET Best Practise</category>
      <category>Events</category>
    </item>
    <item>
      <trackback:ping>http://www.programgood.net/Trackback.aspx?guid=65643b32-763b-4943-87a7-61955c5246b6</trackback:ping>
      <pingback:server>http://www.programgood.net/pingback.aspx</pingback:server>
      <pingback:target>http://www.programgood.net/PermaLink,guid,65643b32-763b-4943-87a7-61955c5246b6.aspx</pingback:target>
      <dc:creator>Dave Mateer</dc:creator>
      <wfw:comment>http://www.programgood.net/CommentView,guid,65643b32-763b-4943-87a7-61955c5246b6.aspx</wfw:comment>
      <wfw:commentRss>http://www.programgood.net/SyndicationService.asmx/GetEntryCommentsRss?guid=65643b32-763b-4943-87a7-61955c5246b6</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">In preparation for JPBoodhoo's course in
Sydney in a months time, I'm looking at the tooling he recommends and going through
this videos on dnrtv.com<br /><br />
this is going to be an ongoing list of ideas for me refer to.. excuse the mess!<br /><br />
Setting up Subversion<br />
http://www.west-wind.com/presentations/subversion/<br /><br />
Console2 - console with an alpha transparency<br />
AltTab - alt tab replacement<br />
Resharper4.5 - makes VS2008 faster<br />
Testdriven.net - unit testing easier<br />
mbunit - unit testing framework<br /><br /><br />
Keyboard shortcuts<br /><br />
Testdriven.net - bound to  in VS2008, Tools, Options, Keyboard.  testdriven.net.runtests..
Ctrl-Shift-Alt-T<br />
rerun tests is to testdriven.net.reruntest.. Ctrl-Shift-Alt-R<br /><br />
Resharper<br />
Ctrl-Alt-v  - introduce variable (highlight and it gens the variable)<br />
Alt-Int - generate constructor and..... from an interface<br />
F2 - rename<br /><br /><p></p><img width="0" height="0" src="http://www.programgood.net/aggbug.ashx?id=65643b32-763b-4943-87a7-61955c5246b6" /></body>
      <title>Tooling and Setup</title>
      <guid isPermaLink="false">http://www.programgood.net/PermaLink,guid,65643b32-763b-4943-87a7-61955c5246b6.aspx</guid>
      <link>http://www.programgood.net/2009/07/03/ToolingAndSetup.aspx</link>
      <pubDate>Fri, 03 Jul 2009 02:53:20 GMT</pubDate>
      <description>In preparation for JPBoodhoo's course in Sydney in a months time, I'm looking at the tooling he recommends and going through this videos on dnrtv.com&lt;br&gt;
&lt;br&gt;
this is going to be an ongoing list of ideas for me refer to.. excuse the mess!&lt;br&gt;
&lt;br&gt;
Setting up Subversion&lt;br&gt;
http://www.west-wind.com/presentations/subversion/&lt;br&gt;
&lt;br&gt;
Console2 - console with an alpha transparency&lt;br&gt;
AltTab - alt tab replacement&lt;br&gt;
Resharper4.5 - makes VS2008 faster&lt;br&gt;
Testdriven.net - unit testing easier&lt;br&gt;
mbunit - unit testing framework&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Keyboard shortcuts&lt;br&gt;
&lt;br&gt;
Testdriven.net - bound to&amp;nbsp; in VS2008, Tools, Options, Keyboard.&amp;nbsp; testdriven.net.runtests..
Ctrl-Shift-Alt-T&lt;br&gt;
rerun tests is to testdriven.net.reruntest.. Ctrl-Shift-Alt-R&lt;br&gt;
&lt;br&gt;
Resharper&lt;br&gt;
Ctrl-Alt-v&amp;nbsp; - introduce variable (highlight and it gens the variable)&lt;br&gt;
Alt-Int - generate constructor and..... from an interface&lt;br&gt;
F2 - rename&lt;br&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.programgood.net/aggbug.ashx?id=65643b32-763b-4943-87a7-61955c5246b6" /&gt;</description>
      <comments>http://www.programgood.net/CommentView,guid,65643b32-763b-4943-87a7-61955c5246b6.aspx</comments>
      <category>ASP.NET Best Practise</category>
      <category>Object Oriented Programming</category>
      <category>Tools</category>
    </item>
  </channel>
</rss>