<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Marcus' Web Development Blog</title>
	
	<link>http://limitedability.agilityhoster.com</link>
	<description>Some people dream of success while others wake up and work hard at it</description>
	<pubDate>Tue, 05 May 2009 12:29:49 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/MarcusWebDevelopmentBlog" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Bind DataTable to Repeater using Subsonic</title>
		<link>http://feedproxy.google.com/~r/MarcusWebDevelopmentBlog/~3/9_B60Ss0NOk/</link>
		<comments>http://limitedability.agilityhoster.com/2009/05/05/bind-datatable-to-repeater-using-subsonic/#comments</comments>
		<pubDate>Tue, 05 May 2009 12:29:49 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[SubSonic]]></category>

		<guid isPermaLink="false">http://limitedability.agilityhoster.com/2009/05/05/bind-datatable-to-repeater-using-subsonic/</guid>
		<description><![CDATA[
DataTable dt = new DataTable();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
     [...]]]></description>
			<content:encoded><![CDATA[<blockquote>
<pre class="code"><span style="color: #2b91af">DataTable </span>dt = <span style="color: blue">new </span><span style="color: #2b91af">DataTable</span>();

        <span style="color: blue">protected void </span>Page_Load(<span style="color: blue">object </span>sender, <span style="color: #2b91af">EventArgs </span>e)
        {
            <span style="color: blue">if </span>(!IsPostBack)
            {
                BindRepeater();
                RepeaterMenu.DataSource = dt;
                RepeaterMenu.DataBind();
            }
        }

        <span style="color: blue">public </span><span style="color: #2b91af">DataTable </span>BindRepeater()
        {
            dt = <span style="color: blue">new </span><span style="color: #2b91af">Select</span>()
                    .From&lt;<span style="color: #2b91af">CmsMenu</span>&gt;()
                    .Where(<span style="color: #2b91af">CmsMenu</span>.PublishedColumn)
                    .IsEqualTo(<span style="color: blue">true</span>)
                    .And(<span style="color: #2b91af">CmsMenu</span>.FooterMenuColumn)
                    .IsEqualTo(<span style="color: blue">true</span>)
                    .OrderAsc(<span style="color: #a31515">&quot;sortOrder&quot;</span>)
                    .ExecuteDataSet().Tables[0];

            <span style="color: blue">return </span>dt;
        }</pre>
<p>  <a href="http://11011.net/software/vspaste"></a></p></blockquote>
<img src="http://feeds.feedburner.com/~r/MarcusWebDevelopmentBlog/~4/9_B60Ss0NOk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://limitedability.agilityhoster.com/2009/05/05/bind-datatable-to-repeater-using-subsonic/feed/</wfw:commentRss>
		<feedburner:origLink>http://limitedability.agilityhoster.com/2009/05/05/bind-datatable-to-repeater-using-subsonic/</feedburner:origLink></item>
		<item>
		<title>TryParse C#</title>
		<link>http://feedproxy.google.com/~r/MarcusWebDevelopmentBlog/~3/DB3sf_6pGy0/</link>
		<comments>http://limitedability.agilityhoster.com/2009/05/05/tryparse-c/#comments</comments>
		<pubDate>Tue, 05 May 2009 10:55:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://limitedability.agilityhoster.com/2009/05/05/tryparse-c/</guid>
		<description><![CDATA[Always forgetting this one!
int sortOrder;
  
//a sort order has been entered
if (Int32.TryParse(txtSortOrder.Text, out sortOrder))
    { }
     else
   {
       sortOrder = 0;
   }
  
]]></description>
			<content:encoded><![CDATA[<p>Always forgetting this one!</p>
<blockquote><pre class="code"><span style="color: blue">int </span>sortOrder;</pre>
<p>  <a href="http://11011.net/software/vspaste"></a></p>
<pre class="code"><span style="color: green">//a sort order has been entered
</span><span style="color: blue">if </span>(<span style="color: #2b91af">Int32</span>.TryParse(txtSortOrder.Text, <span style="color: blue">out </span>sortOrder))
    { }
     <span style="color: blue">else
   </span>{
       sortOrder = 0;
   }</pre>
<p>  <a href="http://11011.net/software/vspaste"></a></p></blockquote>
<img src="http://feeds.feedburner.com/~r/MarcusWebDevelopmentBlog/~4/DB3sf_6pGy0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://limitedability.agilityhoster.com/2009/05/05/tryparse-c/feed/</wfw:commentRss>
		<feedburner:origLink>http://limitedability.agilityhoster.com/2009/05/05/tryparse-c/</feedburner:origLink></item>
		<item>
		<title>Expand TreeView to specific node on page load [asp.net, c#]</title>
		<link>http://feedproxy.google.com/~r/MarcusWebDevelopmentBlog/~3/TaDLqcJ9br8/</link>
		<comments>http://limitedability.agilityhoster.com/2009/04/03/expand-treeview-to-specific-node-on-page-load-aspnet-c/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 05:36:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://limitedability.agilityhoster.com/2009/04/03/expand-treeview-to-specific-node-on-page-load-aspnet-c/</guid>
		<description><![CDATA[I have spent the last day trying to find a solution to what turns out to be a very common problem with the ASP.NET treeview control. Basically, I am pulling my data out of SQL and binding it to my treeview to use as navigation through a series of categories. My problem was that when [...]]]></description>
			<content:encoded><![CDATA[<p>I have spent the last day trying to find a solution to what turns out to be a very common problem with the ASP.NET treeview control. Basically, I am pulling my data out of SQL and binding it to my treeview to use as navigation through a series of categories. My problem was that when I click a category (i’m redirecting to another page based on the category selected) the treeview loses all state and loads a fresh. Oh, my treeview control is in a user control btw, not in a master page.</p>
<p>The solution I came up with (couldn’t find a solution on the web that would work for me, i looked at the recursion method among many others, but for whatever reason it wouldn’t work. Maybe because the control is a user control and not directly within a master page??)&#160; is rather a simple one, but it works! I’m sure there maybe more efficient and better ways of doing it, but like I said, this one works for me!</p>
<p><strong>So this is what I do…</strong>     <br />When a node is clicked I get the valuepath of the node via the SelectedNodeChanged event. I store this value in a session variable. When the resultant page loads I then use the OnPreRender method which is, and I quote;</p>
<blockquote><p><strong><em>&quot;The PreRender event is raised just before the page is about to render its         <br />contents. This is the last chance to modify a page output before it is sent          <br />to the browser&quot;.</em></strong></p>
</blockquote>
<p>In this method I check to see if the session for the valuepath has any data. If it does I check to see if it has a separator. If there is that means we are more than one level deep into our treeview else if not, we are at the root level. If we are more than one level deep I throw the value into an array. I then basically loop through the array writing out the TreeView1.Findnode method as I go. So we are left with something like this;</p>
<blockquote><p><strong><em>TreeView1.FindNode(&quot;6&quot;).Expand();         <br />TreeView1.FindNode(&quot;6/11&quot;).Expand();          <br />TreeView1.FindNode(&quot;6/11/15&quot;).Expand();</em></strong></p>
</blockquote>
<p>That’s basically it. The code is below.</p>
<p><strong>ASP.NET</strong> </p>
<blockquote><pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">TreeView </span><span style="color: red">ID</span><span style="color: blue">=&quot;TreeView1&quot; </span><span style="color: red">NodeWrap</span><span style="color: blue">=&quot;true&quot; </span><span style="color: red">ExpandDepth</span><span style="color: blue">=&quot;0&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot;     </span><span style="color: red">OnTreeNodePopulate</span><span style="color: blue">=&quot;TreeView1_TreeNodePopulate&quot;
</span><span style="color: red">    PathSeparator</span><span style="color: blue">=&quot;/&quot; </span><span style="color: red">ImageSet</span><span style="color: blue">=&quot;MSDN&quot; </span><span style="color: red">CssClass</span><span style="color: blue">=&quot;categoryMenu&quot; </span><span style="color: red">OnDataBound</span><span style="color: blue">=&quot;TreeView1_DataBound&quot;
</span><span style="color: red">    OnSelectedNodeChanged</span><span style="color: blue">=&quot;TreeView1_SelectedNodeChanged&quot; </span><span style="color: red">ShowCheckBoxes</span><span style="color: blue">=&quot;None&quot; </span><span style="color: red">    SelectedNodeStyle-CssClass</span><span style="color: blue">=&quot;categorySelected&quot;&gt;
                &lt;</span><span style="color: #a31515">ParentNodeStyle </span><span style="color: red">Font-Bold</span><span style="color: blue">=&quot;False&quot; </span><span style="color: red">CssClass</span><span style="color: blue">=&quot;navigationLink&quot; /&gt;
                &lt;</span><span style="color: #a31515">HoverNodeStyle </span><span style="color: red">Font-Underline</span><span style="color: blue">=&quot;True&quot; </span><span style="color: red">ForeColor</span><span style="color: blue">=&quot;&quot; /&gt;
                &lt;</span><span style="color: #a31515">NodeStyle </span><span style="color: red">NodeSpacing</span><span style="color: blue">=&quot;0px&quot; </span><span style="color: red">VerticalPadding</span><span style="color: blue">=&quot;0px&quot; /&gt;&lt;/</span><span style="color: #a31515">asp</span><span style="color: blue">:</span><span style="color: #a31515">TreeView</span><span style="color: blue">&gt;</span></pre>
<p>&#160;</p>
</blockquote>
<p>&#160;</p>
<p>C#</p>
<blockquote>
<pre class="code"><span style="color: blue">protected override void </span>OnPreRender(<span style="color: #2b91af">EventArgs </span>e)
    {
        <span style="color: blue">if </span>(Session[<span style="color: #a31515">&quot;SelectedNodeValuePath&quot;</span>] != <span style="color: blue">null</span>)
        {
            <span style="color: green">//the selected node value is something like 6/11
            </span><span style="color: blue">string </span>nodeValuePath = Session[<span style="color: #a31515">&quot;SelectedNodeValuePath&quot;</span>].ToString();

            <span style="color: green">//get the position of the first /
            </span><span style="color: blue">int </span>firstSeparator = nodeValuePath.IndexOf(<span style="color: #a31515">&quot;/&quot;</span>);

            <span style="color: blue">if </span>(nodeValuePath.IndexOf(<span style="color: #a31515">&quot;/&quot;</span>) &gt; 0)
            {
                <span style="color: green">//define the character that separates
                </span><span style="color: blue">char</span>[] separator = { <span style="color: #a31515">'/' </span>};

                <span style="color: green">//split the string
                </span><span style="color: blue">string</span>[] array = nodeValuePath.Split(separator);

                <span style="color: #2b91af">StringBuilder </span>path = <span style="color: blue">new </span><span style="color: #2b91af">StringBuilder</span>();
                <span style="color: blue">int </span>noArrayElements = array.Length;

                <span style="color: green">// if you select the third node down in a tree, the array will write out the following
                // TreeView1.FindNode(&quot;6&quot;).Expand();
                // TreeView1.FindNode(&quot;6/11&quot;).Expand();
                // TreeView1.FindNode(&quot;6/11/15&quot;).Expand();

                </span><span style="color: blue">for </span>(<span style="color: blue">int </span>i = 1; i &lt; array.Length; i++)
                {
                    <span style="color: green">// if there is only one element in my array there is then only 1 node to expand.
                    </span><span style="color: blue">if </span>(noArrayElements == 1)
                    {
                        path.Append(array[i - 1]);
                        TreeView1.FindNode(path.ToString()).Expand();
                    }
                    <span style="color: green">// if there is more than one element i need to add the separator to the node path and then expand the node
                    </span><span style="color: blue">if </span>(noArrayElements &gt; 1)
                    {
                        <span style="color: blue">if </span>(i == 1)
                        {
                            <span style="color: green">// don't prefix searator if first node
                            </span>path.Append(array[i - 1]);
                            TreeView1.FindNode(path.ToString()).Expand();

                        }
                        <span style="color: blue">else
                        </span>{
                            <span style="color: green">// prefix separator for subsequent nodes
                            </span>path.Append(<span style="color: #a31515">&quot;/&quot;</span>);
                            path.Append(array[i - 1]);
                            TreeView1.FindNode(path.ToString()).Expand();
                        }
                    }
                }

            }
            TreeView1.FindNode(Session[<span style="color: #a31515">&quot;SelectedNodeValuePath&quot;</span>].ToString()).Select();

        }
    }</pre>
<p>  <a href="http://11011.net/software/vspaste"></a></p>
<pre class="code"><span style="color: blue"></span></pre>
<pre class="code"><span style="color: blue">protected void </span>TreeView1_SelectedNodeChanged(<span style="color: blue">object </span>sender, <span style="color: #2b91af">EventArgs </span>e)
    {
        <span style="color: green">//Get the value of the selected node
        </span><span style="color: blue">int </span>catID;
        catID = <span style="color: #2b91af">Convert</span>.ToInt32(TreeView1.SelectedValue);
        <span style="color: blue">string </span>valuePath = TreeView1.SelectedNode.ValuePath;
        Session[<span style="color: #a31515">&quot;selectedValue&quot;</span>] = catID;
        Session[<span style="color: #a31515">&quot;SelectedNodeValuePath&quot;</span>] = valuePath;

        <span style="color: green">//Get the name of the selected category
        </span><span style="color: #2b91af">Category </span>c = <span style="color: blue">new </span><span style="color: #2b91af">Category</span>(catID);
        <span style="color: blue">string </span>itemUrl = c.CatName;

        <span style="color: green">//pass the name through our clean URL class for URLrewriting
        </span>itemUrl = <span style="color: #2b91af">CleanURLRewrite</span>.cleanURL(itemUrl);

        <span style="color: green">//Check if we're rewriting urls and redirect accordingly
        </span><span style="color: blue">if </span>(System.<span style="color: #2b91af">Convert</span>.ToBoolean((<span style="color: #2b91af">ConfigurationManager</span>.AppSettings[<span style="color: #a31515">&quot;EnableURLrewrite&quot;</span>])) == <span style="color: blue">true</span>)
        {
            Response.Redirect(<span style="color: #2b91af">ConfigurationManager</span>.AppSettings[<span style="color: #a31515">&quot;cartDirectory&quot;</span>].ToString() + <span style="color: #a31515">&quot;cat/&quot; </span>+ catID + <span style="color: #a31515">&quot;/&quot; </span>+ itemUrl + <span style="color: #a31515">&quot;.aspx&quot;</span>, <span style="color: blue">false</span>);
        }
        <span style="color: blue">else
        </span>{
            Response.Redirect(<span style="color: #2b91af">ConfigurationManager</span>.AppSettings[<span style="color: #a31515">&quot;cartDirectory&quot;</span>].ToString() + <span style="color: #a31515">&quot;Items.aspx?category=&quot; </span>+ catID.ToString(), <span style="color: blue">false</span>);
        }
    }</pre>
<p>  <a href="http://11011.net/software/vspaste"></a></p></blockquote>
<img src="http://feeds.feedburner.com/~r/MarcusWebDevelopmentBlog/~4/TaDLqcJ9br8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://limitedability.agilityhoster.com/2009/04/03/expand-treeview-to-specific-node-on-page-load-aspnet-c/feed/</wfw:commentRss>
		<feedburner:origLink>http://limitedability.agilityhoster.com/2009/04/03/expand-treeview-to-specific-node-on-page-load-aspnet-c/</feedburner:origLink></item>
		<item>
		<title>DELETE all tables in a Database (MS SQL)</title>
		<link>http://feedproxy.google.com/~r/MarcusWebDevelopmentBlog/~3/pV3gjGlpZUo/</link>
		<comments>http://limitedability.agilityhoster.com/2009/03/31/delete-all-tables-in-a-database-ms-sql/#comments</comments>
		<pubDate>Tue, 31 Mar 2009 03:21:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://limitedability.agilityhoster.com/2009/03/31/delete-all-tables-in-a-database-ms-sql/</guid>
		<description><![CDATA[SELECT name INTO #tables from sys.objects where type = 'U'

while (SELECT count(1) FROM #tables) &#62; 0

begin

declare @sql varchar(max)

declare @tbl varchar(255)

SELECT top 1 @tbl = name FROM #tables

SET @sql = 'drop table ' + @tbl

exec(@sql)

DELETE FROM #tables where name = @tbl

end

DROP TABLE #tables


]]></description>
			<content:encoded><![CDATA[<blockquote><pre class="code"><span style="color: blue">SELECT </span>name <span style="color: blue">INTO </span>#tables <span style="color: blue">from </span><span style="color: green">sys</span><span style="color: gray">.</span><span style="color: green">objects </span><span style="color: blue">where type </span><span style="color: gray">= </span><span style="color: red">'U'

</span><span style="color: blue">while </span><span style="color: gray">(</span><span style="color: blue">SELECT </span><span style="color: magenta">count</span><span style="color: gray">(</span>1<span style="color: gray">) </span><span style="color: blue">FROM </span>#tables<span style="color: gray">) &gt; </span>0

<span style="color: blue">begin

declare </span>@sql <span style="color: blue">varchar</span><span style="color: gray">(</span><span style="color: magenta">max</span><span style="color: gray">)

</span><span style="color: blue">declare </span>@tbl <span style="color: blue">varchar</span><span style="color: gray">(</span>255<span style="color: gray">)

</span><span style="color: blue">SELECT top </span>1 @tbl <span style="color: gray">= </span>name <span style="color: blue">FROM </span>#tables

<span style="color: blue">SET </span>@sql <span style="color: gray">= </span><span style="color: red">'drop table ' </span><span style="color: gray">+ </span>@tbl

<span style="color: blue">exec</span><span style="color: gray">(</span>@sql<span style="color: gray">)

</span><span style="color: blue">DELETE FROM </span>#tables <span style="color: blue">where </span>name <span style="color: gray">= </span>@tbl

<span style="color: blue">end

DROP TABLE </span>#tables</pre>
</blockquote>
<p><a href="http://11011.net/software/vspaste"></a></p>
<img src="http://feeds.feedburner.com/~r/MarcusWebDevelopmentBlog/~4/pV3gjGlpZUo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://limitedability.agilityhoster.com/2009/03/31/delete-all-tables-in-a-database-ms-sql/feed/</wfw:commentRss>
		<feedburner:origLink>http://limitedability.agilityhoster.com/2009/03/31/delete-all-tables-in-a-database-ms-sql/</feedburner:origLink></item>
		<item>
		<title>Gridview and SubSonic</title>
		<link>http://feedproxy.google.com/~r/MarcusWebDevelopmentBlog/~3/nxJN9RTILPI/</link>
		<comments>http://limitedability.agilityhoster.com/2009/03/09/gridview-and-subsonic/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 07:15:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[SubSonic]]></category>

		<guid isPermaLink="false">http://limitedability.agilityhoster.com/2009/03/09/gridview-and-subsonic/</guid>
		<description><![CDATA[Sort and page the results
public SortDirection SortDir
    {
        get
        {
            if (ViewState[&#34;sortDirection&#34;] == null)
            {
  [...]]]></description>
			<content:encoded><![CDATA[<p>Sort and page the results</p>
<blockquote><pre class="code"><span style="color: blue">public </span><span style="color: #2b91af">SortDirection </span>SortDir
    {
        <span style="color: blue">get
        </span>{
            <span style="color: blue">if </span>(ViewState[<span style="color: #a31515">&quot;sortDirection&quot;</span>] == <span style="color: blue">null</span>)
            {
                ViewState[<span style="color: #a31515">&quot;sortDirection&quot;</span>] = <span style="color: #2b91af">SortDirection</span>.Ascending;
            } <span style="color: blue">return </span>(<span style="color: #2b91af">SortDirection</span>)ViewState[<span style="color: #a31515">&quot;sortDirection&quot;</span>];
        }
        <span style="color: blue">set
        </span>{
            ViewState[<span style="color: #a31515">&quot;sortDirection&quot;</span>] = <span style="color: blue">value</span>;
        }
    }

    <span style="color: #2b91af">DataSet </span>ds = <span style="color: blue">new </span><span style="color: #2b91af">DataSet</span>();
    <span style="color: #2b91af">DataView </span>dv = <span style="color: blue">new </span><span style="color: #2b91af">DataView</span>();

    <span style="color: blue">protected void </span>Page_Load(<span style="color: blue">object </span>sender, <span style="color: #2b91af">EventArgs </span>e)
    {
        <span style="color: blue">if </span>(!IsPostBack)
        {
            BindGrid();
            GridView1.DataSource = dv;
            GridView1.DataBind();
        }
    }

    <span style="color: blue">private </span><span style="color: #2b91af">DataView </span>BindGrid()
    {
        ds = <span style="color: blue">new </span><span style="color: #2b91af">Query</span>(AnthemWeb.DAL.<span style="color: #2b91af">Item</span>.Schema).ExecuteDataSet();

        <span style="color: blue">if </span>(ViewState[<span style="color: #a31515">&quot;sortExpr&quot;</span>] != <span style="color: blue">null</span>)
        {
            dv = <span style="color: blue">new </span><span style="color: #2b91af">DataView</span>(ds.Tables[0]);
            dv.Sort = (<span style="color: blue">string</span>)ViewState[<span style="color: #a31515">&quot;sortExpr&quot;</span>];
        }
        <span style="color: blue">else
        </span>{
            dv = ds.Tables[0].DefaultView;
        }

        <span style="color: blue">return </span>dv;
    }

    <span style="color: blue">protected void </span>GridView1_PageIndexChanging(<span style="color: blue">object </span>sender, <span style="color: #2b91af">GridViewPageEventArgs </span>e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        GridView1.DataSource = BindGrid();
        GridView1.DataBind();
    }

    <span style="color: blue">protected void </span>GridView1_Sorting(<span style="color: blue">object </span>sender, <span style="color: #2b91af">GridViewSortEventArgs </span>e)
    {
        <span style="color: blue">string </span>stExp = e.SortExpression;
        <span style="color: blue">string </span>stDir = <span style="color: blue">string</span>.Empty;
        <span style="color: blue">if </span>(SortDir == <span style="color: #2b91af">SortDirection</span>.Ascending)
        {
            SortDir = <span style="color: #2b91af">SortDirection</span>.Descending;
            stDir = <span style="color: #a31515">&quot;DESC&quot;</span>;
        }
        <span style="color: blue">else
        </span>{
            SortDir = <span style="color: #2b91af">SortDirection</span>.Ascending;
            stDir = <span style="color: #a31515">&quot;ASC&quot;</span>;
        }

        ViewState[<span style="color: #a31515">&quot;sortExpr&quot;</span>] = e.SortExpression + <span style="color: #a31515">&quot; &quot; </span>+ stDir;
        GridView1.DataSource = BindGrid();
        GridView1.DataBind();
    }

    <span style="color: blue">protected void </span>GridView1_SelectedIndexChanged(<span style="color: blue">object </span>sender, <span style="color: #2b91af">EventArgs </span>e)
    {
        <span style="color: blue">int </span>selectedRowIndex;
        selectedRowIndex = GridView1.SelectedIndex;
        <span style="color: #2b91af">GridViewRow </span>row = GridView1.Rows[selectedRowIndex];
        <span style="color: blue">string </span>ID = row.Cells[0].Text;

        Response.Redirect(<span style="color: #a31515">&quot;customer-details.aspx?ID=&quot; </span>+ ID, <span style="color: blue">false</span>);
    }

    <span style="color: blue">protected void </span>btnSearch_Click(<span style="color: blue">object </span>sender, <span style="color: #2b91af">EventArgs </span>e)
    {
        BindGrid();
    }</pre>
<p>  <a href="http://11011.net/software/vspaste"></a></p></blockquote>
<img src="http://feeds.feedburner.com/~r/MarcusWebDevelopmentBlog/~4/nxJN9RTILPI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://limitedability.agilityhoster.com/2009/03/09/gridview-and-subsonic/feed/</wfw:commentRss>
		<feedburner:origLink>http://limitedability.agilityhoster.com/2009/03/09/gridview-and-subsonic/</feedburner:origLink></item>
		<item>
		<title>Subsonic CRUD Syntax</title>
		<link>http://feedproxy.google.com/~r/MarcusWebDevelopmentBlog/~3/CHbbyTfwNzw/</link>
		<comments>http://limitedability.agilityhoster.com/2009/03/06/subsonic-crud-syntax/#comments</comments>
		<pubDate>Fri, 06 Mar 2009 02:40:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[SubSonic]]></category>

		<guid isPermaLink="false">http://limitedability.agilityhoster.com/2009/03/06/subsonic-crud-syntax/</guid>
		<description><![CDATA[Started this week to use Subsonic to generate my DAL. I got this handy reference from their forum for doing the INSERTS etc&#8230;
&#160; private void BindNames()      &#160;&#160;&#160; {&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#160;&#160;&#160;&#160;&#160;&#160;&#160; AddBook.DLL.AddressBookCollection list = new AddBook.DLL.AddressBookCollection().OrderByAsc(&#34;Name&#34;).Load();       &#160;&#160;&#160;&#160;&#160;&#160;&#160; this.ddNames.DataSource = list;       [...]]]></description>
			<content:encoded><![CDATA[<p>Started this week to use Subsonic to generate my DAL. I got this handy reference from their forum for doing the INSERTS etc&#8230;</p>
<blockquote><p>&#160; private void BindNames()      <br />&#160;&#160;&#160; {&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; AddBook.DLL.AddressBookCollection list = new AddBook.DLL.AddressBookCollection().OrderByAsc(&quot;Name&quot;).Load();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.ddNames.DataSource = list;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.ddNames.DataTextField = &quot;Name&quot;;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.ddNames.DataValueField = &quot;UserID&quot;;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.ddNames.DataBind();       <br />&#160;&#160;&#160; }       <br />&#160;&#160;&#160; protected void btnSelect_Click(object sender, EventArgs e)       <br />&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; AddBook.DLL.AddressBook ab = new AddBook.DLL.AddressBook(ddNames.SelectedValue);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.tbName.Text = ab.Name;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.tbSurname.Text = ab.Surname;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.tbAddress.Text = ab.Address;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.tbHomePhone.Text = ab.HomePhone;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.tbMobilePhone.Text = ab.MobilePhone;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160; protected void btnDelete_Click(object sender, EventArgs e)      <br />&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; AddBook.DLL.AddressBook ab = new AddBook.DLL.AddressBook(ddNames.SelectedValue);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; AddBook.DLL.AddressBook.Delete(ab.UserID);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; BindNames();&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160; }       <br />&#160;&#160;&#160; </p>
<p>protected void btnUpdate_Click(object sender, EventArgs e)     <br />&#160;&#160;&#160; {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; AddBook.DLL.AddressBook ab = new AddBook.DLL.AddressBook(ddNames.SelectedValue);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ab.Name = tbName.Text;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ab.Surname = tbSurname.Text;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ab.Address = tbAddress.Text;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ab.HomePhone = tbHomePhone.Text;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ab.MobilePhone = tbMobilePhone.Text;      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ab.Save();      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; BindNames();      <br />&#160;&#160;&#160; }</p>
<p>&#160;&#160;&#160; protected void btnInsert_Click(object sender, EventArgs e)      <br />&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; AddBook.DLL.AddressBook ab = new AddBook.DLL.AddressBook();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ab.Name = tbName.Text;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ab.Surname = tbSurname.Text;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ab.Address = tbAddress.Text;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ab.HomePhone = tbHomePhone.Text;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ab.MobilePhone = tbMobilePhone.Text;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; ab.Save();       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; BindNames();       <br />&#160;&#160;&#160; }</p>
</blockquote>
<img src="http://feeds.feedburner.com/~r/MarcusWebDevelopmentBlog/~4/CHbbyTfwNzw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://limitedability.agilityhoster.com/2009/03/06/subsonic-crud-syntax/feed/</wfw:commentRss>
		<feedburner:origLink>http://limitedability.agilityhoster.com/2009/03/06/subsonic-crud-syntax/</feedburner:origLink></item>
		<item>
		<title>Get loaded page name</title>
		<link>http://feedproxy.google.com/~r/MarcusWebDevelopmentBlog/~3/1TDHgh7snww/</link>
		<comments>http://limitedability.agilityhoster.com/2009/03/03/get-loaded-page-name/#comments</comments>
		<pubDate>Tue, 03 Mar 2009 10:07:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://limitedability.agilityhoster.com/2009/03/03/get-loaded-page-name/</guid>
		<description><![CDATA[Example page = www.mysite.com/pickup-golding.aspx
C# code
string loadedPageName = Path.GetFileName(Page.Request.PhysicalPath);
        Response.Write(loadedPageName);


Result = pickup-golding.aspx
]]></description>
			<content:encoded><![CDATA[<p>Example page = <a href="http://www.mysite.com/pickup-golding.aspx">www.mysite.com/pickup-golding.aspx</a></p>
<p>C# code</p>
<blockquote><pre class="code"><span style="color: blue">string </span>loadedPageName = <span style="color: #2b91af">Path</span>.GetFileName(Page.Request.PhysicalPath);
        Response.Write(loadedPageName);</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
</blockquote>
<p>Result = pickup-golding.aspx</p>
<img src="http://feeds.feedburner.com/~r/MarcusWebDevelopmentBlog/~4/1TDHgh7snww" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://limitedability.agilityhoster.com/2009/03/03/get-loaded-page-name/feed/</wfw:commentRss>
		<feedburner:origLink>http://limitedability.agilityhoster.com/2009/03/03/get-loaded-page-name/</feedburner:origLink></item>
		<item>
		<title>SQL String Functions</title>
		<link>http://feedproxy.google.com/~r/MarcusWebDevelopmentBlog/~3/hyhemJatn4Y/</link>
		<comments>http://limitedability.agilityhoster.com/2009/02/27/sql-string-functions/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 05:30:02 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://limitedability.agilityhoster.com/2009/02/27/sql-string-functions/</guid>
		<description><![CDATA[Got these very useful references from http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html
SQL String Functions
Sql string function is a built-in string function.     It perform an operation on a string input value and return a string or numeric value.      Below is All built-in Sql string function :      ASCII, [...]]]></description>
			<content:encoded><![CDATA[<p>Got these very useful references from <a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html">http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html</a></p>
<p><a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html">SQL String Functions</a></p>
<blockquote><p>Sql string function is a built-in string function.     <br />It perform an operation on a string input value and return a string or numeric value.      <br />Below is All built-in Sql string function :      <br /><a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorASCII">ASCII</a>, NCHAR, SOUNDEX, CHAR, PATINDEX, <a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorSPACE"></a><a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorSPACE">SPACE</a>, CHARINDEX, <a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorREPLACE">REPLACE</a>, STR, DIFFERENCE, QUOTENAME, STUFF, <a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorLEFT"></a><a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorLEFT">LEFT</a>, <a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorREPLICATE"></a><a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorREPLICATE">REPLICATE</a>, <a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorSUBSTRING"></a><a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorSUBSTRING">SUBSTRING</a>, <a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorLEN"></a><a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorLEN">LEN</a>, <a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorREVERSE"></a><a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorREVERSE">REVERSE</a>, <a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorUNICODE"></a><a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorUNICODE">UNICODE</a>, <a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorLOWER"></a><a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorLOWER">LOWER</a>, <a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorRIGHT">RIGHT</a>, <a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorUPPER"></a><a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorUPPER">UPPER</a>, <a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorLTRIM"></a><a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorLTRIM">LTRIM</a>, <a href="http://sqltutorials.blogspot.com/2007/06/sql-string-functions.html#anchorRTRIM">RTRIM</a>      <br /><strong>Example SQL String Function</strong> - <a name="anchorASCII"></a><a name="anchorASCII"><strong>ASCII</strong></a><strong></strong>      <br />- Returns the ASCII code value of a keyboard button and the rest etc (@,R,9,*) .      <br /><strong>Syntax </strong>- ASCII ( character)      <br />SELECT ASCII(&#8217;a') &#8212; Value = <strong>97</strong>      <br />SELECT ASCII(&#8217;b') &#8212; Value = <strong>98</strong>      <br />SELECT ASCII(&#8217;c') &#8212; Value = <strong>99</strong>      <br />SELECT ASCII(&#8217;A') &#8212; Value = <strong>65</strong>      <br />SELECT ASCII(&#8217;B') &#8212; Value = <strong>66</strong>      <br />SELECT ASCII(&#8217;C') &#8212; Value = <strong>67</strong>      <br />SELECT ASCII(&#8217;1&#8242;) &#8212; Value = <strong>49</strong>      <br />SELECT ASCII(&#8217;2&#8242;) &#8212; Value = <strong>50</strong>      <br />SELECT ASCII(&#8217;3&#8242;) &#8212; Value = <strong>51</strong>      <br />SELECT ASCII(&#8217;4&#8242;) &#8212; Value = <strong>52</strong>      <br />SELECT ASCII(&#8217;5&#8242;) &#8212; Value = <strong>53</strong>      <br /><strong>Example SQL String Function</strong> - <a name="anchorSPACE"><strong>SPACE</strong></a><strong> </strong>      <br />-Returns spaces in your SQL query (you can specific the size of space).      <br /><strong>Syntax -</strong> SPACE ( integer)      <br />SELECT (&#8217;SQL&#8217;) + SPACE(0) + (&#8217;TUTORIALS&#8217;)      <br />&#8211; Value = <strong>SQLTUTORIALS</strong>      <br />SELECT (&#8217;SQL&#8217;) + SPACE(1) + (&#8217;TUTORIALS&#8217;)      <br />&#8211; Value = <strong>SQL TUTORIALS</strong>      <br /><strong>Example SQL String Function</strong> - <strong>CHARINDEX</strong>      <br />-Returns the starting position of a character string.      <br /><strong>Syntax - </strong>CHARINDEX ( string1, string2 [ , start_location ] )      <br />SELECT CHARINDEX(&#8217;SQL&#8217;, &#8216;Well organized understand SQL tutorial&#8217;)      <br />&#8211; Value = <strong>27       <br /></strong>SELECT CHARINDEX(&#8217;SQL&#8217;, &#8216;Well organized understand SQL tutorial&#8217;, 20)      <br />&#8211; Value = <strong>27</strong>      <br />SELECT CHARINDEX(&#8217;SQL&#8217;, &#8216;Well organized understand SQL tutorial&#8217;, 30)      <br />&#8211; Value = <strong>0</strong> (Because the index is count from 30 and above)      <br /><strong>Example SQL String Function</strong> - <a name="anchorREPLACE"></a><a name="anchorREPLACE"><strong>REPLACE</strong></a><strong></strong>      <br />-Replaces all occurrences of the string2 in the string1 with string3.      <br /><strong>Syntax </strong>- REPLACE ( &#8217;string1&#8242; , &#8217;string2&#8242; , &#8217;string3&#8242; )      <br />SELECT REPLACE(&#8217;All Function&#8217; , &#8216;All&#8217;, &#8216;SQL&#8217;)      <br />&#8211; Value = <strong>SQL Function</strong>      <br /><strong></strong>      <br /><strong></strong>      <br /><strong>Example SQL String Function</strong> - <strong>QUOTENAME</strong>      <br />-Returns a Unicode string with the delimiters added to make the input string a valid Microsoft&#174; SQL Server&#8482; delimited identifier.      <br /><strong>Syntax</strong> - QUOTENAME ( &#8217;string&#8217; [ , 'quote_character' ] )      <br />SELECT QUOTENAME(&#8217;Sql[]String&#8217;)      <br />&#8211; Value = <strong>[Sql[]]String]</strong>      <br /><strong></strong>      <br /><strong>Example SQL String Function</strong> - <a name="anchorSTUFF"></a><a name="anchorSTUFF"><strong>STUFF</strong></a><strong></strong>      <br />- Deletes a specified length of characters and inserts string at a specified starting index.      <br /><strong>Syntax</strong> - STUFF ( string1 , startindex , length , string2 )      <br />SELECT STUFF(&#8217;SqlTutorial&#8217;, 4, 6, &#8216;Function&#8217;)      <br />&#8211; Value = <strong>SqlFunctional</strong>      <br />SELECT STUFF(&#8217;GoodMorning&#8217;, 5, 3, &#8216;good&#8217;)      <br />&#8211; Value = <strong>Goodgoodning</strong>      <br /><strong></strong>      <br /><strong></strong>      <br /><strong>Example SQL String Function</strong> - <strong><a name="anchorLEFT">LEFT</a></strong>      <br />-Returns left part of a string with the specified number of characters.      <br /><strong>Syntax </strong>- LEFT ( string , integer)      <br />SELECT LEFT(&#8217;TravelYourself&#8217;, 6)      <br />&#8211; Value = <strong>Travel</strong>      <br />SELECT LEFT(&#8217;BeautyCentury&#8217;,6)      <br />&#8211; Value = <strong>Beauty</strong>      <br /><strong></strong>      <br /><strong></strong>      <br /><strong>Example SQL String Function</strong> - <strong><a name="anchorRIGHT">RIGHT</a></strong>      <br />-Returns right part of a string with the specified number of characters.      <br /><strong>Syntax</strong> - RIGHT( string , integer)      <br />SELECT RIGHT(&#8217;TravelYourself&#8217;, 6)      <br />&#8211; Value = <strong>urself</strong>      <br />SELECT RIGHT(&#8217;BeautyCentury&#8217;,6)      <br />&#8211; Value = <strong>Century</strong>      <br /><strong></strong>      <br /><strong>Example SQL String Function</strong> - <strong><a name="anchorREPLICATE">REPLICATE</a></strong>      <br />-Repeats string for a specified number of times.      <br /><strong>Syntax</strong> - REPLICATE (string, integer)      <br />SELECT REPLICATE(&#8217;Sql&#8217;, 2)      <br />&#8211; Value = <strong>SqlSql</strong>      <br /><strong></strong>      <br /><strong></strong>      <br /><strong>Example SQL String Function</strong> - <strong><a name="anchorSUBSTRING">SUBSTRING</a></strong>      <br />-Returns part of a string.      <br /><strong>Syntax</strong> - SUBSTRING ( string, startindex , length )      <br />SELECT SUBSTRING(&#8217;SQLServer&#8217;, 4, 3)      <br />&#8211; Value = <strong>Ser</strong>      <br /><strong></strong>      <br /><strong></strong>      <br /><strong>Example SQL String Function</strong> - <strong><a name="anchorLEN">LEN</a></strong>      <br />-Returns number of characters in a string.      <br /><strong>Syntax</strong> - LEN( string)       <br />SELECT LEN(&#8217;SQLServer&#8217;)      <br />&#8211; Value = <strong>9</strong>      <br /><strong></strong>      <br /><strong></strong>      <br /><strong>Example SQL String Function</strong> - <strong><a name="anchorREVERSE">REVERSE</a></strong>      <br />-Returns reverse a string.      <br /><strong>Syntax</strong> - REVERSE( string)      <br />SELECT REVERSE(&#8217;SQLServer&#8217;)      <br />&#8211; Value = <strong>revreSLQS</strong>      <br /><strong></strong>      <br /><strong></strong>      <br /><strong>Example SQL String Function</strong> - <strong><a name="anchorUNICODE">UNICODE</a></strong>      <br />-Returns Unicode standard integer value.      <br /><strong>Syntax</strong> - UNICODE( char)      <br />SELECT UNICODE(&#8217;SqlServer&#8217;)      <br />&#8211; Value = <strong>83</strong> (it take first character)      <br />SELECT UNICODE(&#8217;S')      <br />&#8211; Value = <strong>83</strong>      <br /><strong></strong>      <br /><strong>Example SQL String Function</strong> - <strong><a name="anchorLOWER">LOWER</a></strong>      <br />-Convert string to lowercase.      <br /><strong>Syntax</strong> - LOWER( string )      <br />SELECT LOWER(&#8217;SQLServer&#8217;)      <br />&#8211; Value =<strong> sqlserver</strong>      <br /><strong></strong>      <br /><strong></strong>      <br /><strong>Example SQL String Function</strong> - <strong><a name="anchorUPPER">UPPER</a></strong>      <br />-Convert string to Uppercase.      <br /><strong>Syntax</strong> - UPPER( string )       <br />SELECT UPPER(&#8217;sqlserver&#8217;)      <br />&#8211; Value = <strong>SQLSERVER</strong>      <br /><strong></strong>      <br /><strong></strong>      <br /><strong>Example SQL String Function</strong> - <strong><a name="anchorLTRIM">LTRIM</a></strong>      <br />-Returns a string after removing leading blanks on Left side.      <br /><strong>Syntax</strong> - LTRIM( string )      <br />SELECT LTRIM(&#8217; sqlserver&#8217;)      <br />&#8211; Value = <strong>&#8217;sqlserver&#8217;</strong> (Remove left side space or blanks)      <br /><strong>Example SQL String Function</strong> - <a name="anchorRTRIM"><strong>RTRIM</strong> </a>      <br />-Returns a string after removing leading blanks on Right side.      <br /><strong>Syntax</strong> - RTRIM( string )      <br />SELECT RTRIM(&#8217;SqlServer &#8216;)      <br />&#8211; Value = <strong>&#8216;SqlServer&#8217;</strong> (Remove right side space or blanks)</p>
</blockquote>
<img src="http://feeds.feedburner.com/~r/MarcusWebDevelopmentBlog/~4/hyhemJatn4Y" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://limitedability.agilityhoster.com/2009/02/27/sql-string-functions/feed/</wfw:commentRss>
		<feedburner:origLink>http://limitedability.agilityhoster.com/2009/02/27/sql-string-functions/</feedburner:origLink></item>
		<item>
		<title>Read XML</title>
		<link>http://feedproxy.google.com/~r/MarcusWebDevelopmentBlog/~3/GWwcObQ1mW0/</link>
		<comments>http://limitedability.agilityhoster.com/2009/02/24/read-xml/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 04:42:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://limitedability.agilityhoster.com/2009/02/24/read-xml/</guid>
		<description><![CDATA[The XML File
&#60;client_order ordID=&#34;14&#34; supplierID=&#34;000002&#34;&#62;
  &#60;item_order itoItemID=&#34;12&#34; itoItemQty=&#34;1&#34; itoItemPrice=&#34;35.99&#34; itoTaxAmount=&#34;3.00&#34; itemCode=&#34;LD3162&#34; /&#62;
  &#60;item_order itoItemID=&#34;3&#34; itoItemQty=&#34;0&#34; itoItemPrice=&#34;29.99&#34; itoTaxAmount=&#34;3.00&#34; itemCode=&#34;LD3278&#34; /&#62;
  &#60;item_order itoItemID=&#34;7&#34; itoItemQty=&#34;0&#34; itoItemPrice=&#34;31.99&#34; itoTaxAmount=&#34;3.00&#34; itemCode=&#34;LD3226&#34; /&#62;
  &#60;item_order itoItemID=&#34;10&#34; itoItemQty=&#34;0&#34; itoItemPrice=&#34;31.99&#34; itoTaxAmount=&#34;3.00&#34; itemCode=&#34;LD3226&#34; /&#62;
  &#60;item_order itoItemID=&#34;9&#34; itoItemQty=&#34;0&#34; itoItemPrice=&#34;29.99&#34; itoTaxAmount=&#34;3.00&#34; itemCode=&#34;LD3226&#34; /&#62;
&#60;/client_order&#62;


&#160;
The CODE ;o)

//Get the XML
       [...]]]></description>
			<content:encoded><![CDATA[<p>The XML File</p>
<blockquote><pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">client_order </span><span style="color: red">ordID</span><span style="color: blue">=</span>&quot;<span style="color: blue">14</span>&quot; <span style="color: red">supplierID</span><span style="color: blue">=</span>&quot;<span style="color: blue">000002</span>&quot;<span style="color: blue">&gt;
  &lt;</span><span style="color: #a31515">item_order </span><span style="color: red">itoItemID</span><span style="color: blue">=</span>&quot;<span style="color: blue">12</span>&quot; <span style="color: red">itoItemQty</span><span style="color: blue">=</span>&quot;<span style="color: blue">1</span>&quot; <span style="color: red">itoItemPrice</span><span style="color: blue">=</span>&quot;<span style="color: blue">35.99</span>&quot; <span style="color: red">itoTaxAmount</span><span style="color: blue">=</span>&quot;<span style="color: blue">3.00</span>&quot; <span style="color: red">itemCode</span><span style="color: blue">=</span>&quot;<span style="color: blue">LD3162</span>&quot; <span style="color: blue">/&gt;
  &lt;</span><span style="color: #a31515">item_order </span><span style="color: red">itoItemID</span><span style="color: blue">=</span>&quot;<span style="color: blue">3</span>&quot; <span style="color: red">itoItemQty</span><span style="color: blue">=</span>&quot;<span style="color: blue">0</span>&quot; <span style="color: red">itoItemPrice</span><span style="color: blue">=</span>&quot;<span style="color: blue">29.99</span>&quot; <span style="color: red">itoTaxAmount</span><span style="color: blue">=</span>&quot;<span style="color: blue">3.00</span>&quot; <span style="color: red">itemCode</span><span style="color: blue">=</span>&quot;<span style="color: blue">LD3278</span>&quot; <span style="color: blue">/&gt;
  &lt;</span><span style="color: #a31515">item_order </span><span style="color: red">itoItemID</span><span style="color: blue">=</span>&quot;<span style="color: blue">7</span>&quot; <span style="color: red">itoItemQty</span><span style="color: blue">=</span>&quot;<span style="color: blue">0</span>&quot; <span style="color: red">itoItemPrice</span><span style="color: blue">=</span>&quot;<span style="color: blue">31.99</span>&quot; <span style="color: red">itoTaxAmount</span><span style="color: blue">=</span>&quot;<span style="color: blue">3.00</span>&quot; <span style="color: red">itemCode</span><span style="color: blue">=</span>&quot;<span style="color: blue">LD3226</span>&quot; <span style="color: blue">/&gt;
  &lt;</span><span style="color: #a31515">item_order </span><span style="color: red">itoItemID</span><span style="color: blue">=</span>&quot;<span style="color: blue">10</span>&quot; <span style="color: red">itoItemQty</span><span style="color: blue">=</span>&quot;<span style="color: blue">0</span>&quot; <span style="color: red">itoItemPrice</span><span style="color: blue">=</span>&quot;<span style="color: blue">31.99</span>&quot; <span style="color: red">itoTaxAmount</span><span style="color: blue">=</span>&quot;<span style="color: blue">3.00</span>&quot; <span style="color: red">itemCode</span><span style="color: blue">=</span>&quot;<span style="color: blue">LD3226</span>&quot; <span style="color: blue">/&gt;
  &lt;</span><span style="color: #a31515">item_order </span><span style="color: red">itoItemID</span><span style="color: blue">=</span>&quot;<span style="color: blue">9</span>&quot; <span style="color: red">itoItemQty</span><span style="color: blue">=</span>&quot;<span style="color: blue">0</span>&quot; <span style="color: red">itoItemPrice</span><span style="color: blue">=</span>&quot;<span style="color: blue">29.99</span>&quot; <span style="color: red">itoTaxAmount</span><span style="color: blue">=</span>&quot;<span style="color: blue">3.00</span>&quot; <span style="color: red">itemCode</span><span style="color: blue">=</span>&quot;<span style="color: blue">LD3226</span>&quot; <span style="color: blue">/&gt;
&lt;/</span><span style="color: #a31515">client_order</span><span style="color: blue">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
</blockquote>
<p>&#160;</p>
<p>The CODE ;o)</p>
<blockquote>
<pre class="code"><span style="color: green">//Get the XML
                    </span><span style="color: blue">string </span>responseXML = r[<span style="color: #a31515">&quot;Response&quot;</span>].ToString();

                    <span style="color: blue">try
                    </span>{
                        <span style="color: #2b91af">XmlDocument </span>contentXML = <span style="color: blue">new </span><span style="color: #2b91af">XmlDocument</span>();
                        contentXML.LoadXml(responseXML);

                        <span style="color: green">//Get the attribute values from the root node &lt;client_order&gt;
                        </span><span style="color: #2b91af">XmlNode </span>client_orderNode = contentXML.DocumentElement.SelectSingleNode(<span style="color: #a31515">&quot;//client_order&quot;</span>);
                        <span style="color: blue">string </span>supplierID = client_orderNode.Attributes[<span style="color: #a31515">&quot;supplierID&quot;</span>].Value.ToString();
                        <span style="color: blue">string </span>ordID = client_orderNode.Attributes[<span style="color: #a31515">&quot;ordID&quot;</span>].Value.ToString();

                        <span style="color: blue">string </span>supplierName = <span style="color: #2b91af">CommonDBCommands</span>.SelectValue(connectionString, <span style="color: #a31515">&quot;suppliers&quot;</span>, <span style="color: #a31515">&quot;supplierName&quot;</span>,
                            <span style="color: #a31515">&quot;supplierID&quot;</span>, supplierID);

                        <span style="color: green">//GET the order id and supplier as recorded in the XML response.
                        </span><span style="color: #2b91af">Debug</span>.Print(<span style="color: #a31515">&quot;Supplier ID = &quot; </span>+ supplierID);
                        <span style="color: #2b91af">Debug</span>.Print(<span style="color: #a31515">&quot;Order ID = &quot; </span>+ ordID);

                        <span style="color: green">//read each element &lt;item_order&gt; in &lt;client_order&gt; and get the attribute values
                        </span><span style="color: blue">foreach </span>(<span style="color: #2b91af">XmlNode </span>node <span style="color: blue">in </span>client_orderNode)
                        {
                            <span style="color: #2b91af">XmlElement </span>item_order = (<span style="color: #2b91af">XmlElement</span>)node;

                            <span style="color: blue">string </span>itemID = <span style="color: #a31515">&quot;&quot;</span>;
                            <span style="color: blue">string </span>itemQty = <span style="color: #a31515">&quot;&quot;</span>;
                            <span style="color: blue">string </span>itemPrice = <span style="color: #a31515">&quot;&quot;</span>;
                            <span style="color: blue">string </span>itemTaxAmount = <span style="color: #a31515">&quot;&quot;</span>;
                            <span style="color: blue">string </span>itemCode = <span style="color: #a31515">&quot;&quot;</span>;

                            <span style="color: blue">if </span>(item_order.HasAttributes)
                            {
                                itemID = item_order.Attributes[<span style="color: #a31515">&quot;itoItemID&quot;</span>].InnerText;
                                itemQty = item_order.Attributes[<span style="color: #a31515">&quot;itoItemQty&quot;</span>].InnerText;
                                itemPrice = item_order.Attributes[<span style="color: #a31515">&quot;itoItemPrice&quot;</span>].InnerText;
                                itemTaxAmount = item_order.Attributes[<span style="color: #a31515">&quot;itoTaxAmount&quot;</span>].InnerText;
                                itemCode = item_order.Attributes[<span style="color: #a31515">&quot;itemCode&quot;</span>].InnerText;

                                <span style="color: blue">if </span>(itemID == hItemID)
                                {
                                    <span style="color: #2b91af">DataRow </span>row = dt.NewRow();
                                    row[<span style="color: #a31515">&quot;SupplierName&quot;</span>] = supplierName;
                                    row[<span style="color: #a31515">&quot;itemID&quot;</span>] = itemID;
                                    row[<span style="color: #a31515">&quot;Qty&quot;</span>] = <span style="color: #2b91af">Convert</span>.ToDecimal(itemQty);
                                    row[<span style="color: #a31515">&quot;price&quot;</span>] = <span style="color: #2b91af">Convert</span>.ToDecimal(itemPrice);
                                    row[<span style="color: #a31515">&quot;taxAmount&quot;</span>] = <span style="color: #2b91af">Convert</span>.ToDecimal(itemTaxAmount);
                                    row[<span style="color: #a31515">&quot;itemCode&quot;</span>] = itemCode;

                                    dt.Rows.Add(row);
                                }
                            }

                            <span style="color: #2b91af">Debug</span>.Print(<span style="color: #a31515">&quot;item ID  = &quot; </span>+ itemID);
                            <span style="color: #2b91af">Debug</span>.Print(<span style="color: #a31515">&quot;price  = $&quot; </span>+ itemPrice);

                        }
                    }
                    <span style="color: blue">catch </span>(<span style="color: #2b91af">Exception </span>ex)
                    {
                        Response.Write(ex.Message.ToString());
                    }</pre>
<p>  <a href="http://11011.net/software/vspaste"></a></p></blockquote>
<img src="http://feeds.feedburner.com/~r/MarcusWebDevelopmentBlog/~4/GWwcObQ1mW0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://limitedability.agilityhoster.com/2009/02/24/read-xml/feed/</wfw:commentRss>
		<feedburner:origLink>http://limitedability.agilityhoster.com/2009/02/24/read-xml/</feedburner:origLink></item>
		<item>
		<title>Clear Browser History</title>
		<link>http://feedproxy.google.com/~r/MarcusWebDevelopmentBlog/~3/OqlI0CVbGDQ/</link>
		<comments>http://limitedability.agilityhoster.com/2009/02/24/clear-browser-history/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 04:34:57 +0000</pubDate>
		<dc:creator>admin</dc:creator>
		
		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://limitedability.agilityhoster.com/2009/02/24/clear-browser-history/</guid>
		<description><![CDATA[&#160;
protected void LogOut()
    {
        Session.Abandon();
        string nextpage = "Logoutt.aspx";
        Response.Write("&#60;script language=javascript&#62;");

        Response.Write("{");
        Response.Write(" var Backlen=history.length;");

   [...]]]></description>
			<content:encoded><![CDATA[<blockquote><pre>&nbsp;</pre>
<pre class="code"><span style="color: blue">protected void </span>LogOut()
    {
        Session.Abandon();
        <span style="color: blue">string </span>nextpage = <span style="color: #a31515">"Logoutt.aspx"</span>;
        Response.Write(<span style="color: #a31515">"&lt;script language=javascript&gt;"</span>);

        Response.Write(<span style="color: #a31515">"{"</span>);
        Response.Write(<span style="color: #a31515">" var Backlen=history.length;"</span>);

        Response.Write(<span style="color: #a31515">" history.go(-Backlen);"</span>);
        Response.Write(<span style="color: #a31515">" window.location.href='" </span>+ nextpage + <span style="color: #a31515">"'; "</span>);

        Response.Write(<span style="color: #a31515">"}"</span>);
        Response.Write(<span style="color: #a31515">"&lt;/script&gt;"</span>);

    }</pre>
<p><a href="http://11011.net/software/vspaste"></a></p></blockquote>
<img src="http://feeds.feedburner.com/~r/MarcusWebDevelopmentBlog/~4/OqlI0CVbGDQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://limitedability.agilityhoster.com/2009/02/24/clear-browser-history/feed/</wfw:commentRss>
		<feedburner:origLink>http://limitedability.agilityhoster.com/2009/02/24/clear-browser-history/</feedburner:origLink></item>
	</channel>
</rss>
