<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	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:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Pranas.NET &#187; Random Thoughts</title>
	<atom:link href="http://pranas.net/category/thoughts/feed/" rel="self" type="application/rss+xml" />
	<link>http://pranas.net</link>
	<description>Keeping Computers Simple</description>
	<lastBuildDate>Fri, 30 Apr 2010 22:03:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Remote Desktop to Console/Admin Session on Windows Server 2003</title>
		<link>http://pranas.net/2010/04/remote-desktop-to-console-admin-session-on-windows-server-2003/</link>
		<comments>http://pranas.net/2010/04/remote-desktop-to-console-admin-session-on-windows-server-2003/#comments</comments>
		<pubDate>Fri, 30 Apr 2010 22:03:25 +0000</pubDate>
		<dc:creator>Ruslan Sudentas</dc:creator>
				<category><![CDATA[Random Thoughts]]></category>

		<guid isPermaLink="false">http://pranas.net/?p=139</guid>
		<description><![CDATA[When you Remote Desktop to a Windows XP  Professional computer, you always connect to the console (main/default) session.  This  is the default for Remote Desktop to Windows XP Professional.  When you  remote desktop to a Windows Server 2003 computer, the default is to  start a new session.
This is how you can [...]]]></description>
			<content:encoded><![CDATA[<p>When you Remote Desktop to a Windows XP  Professional computer, you always connect to the console (main/default) session.  This  is the default for Remote Desktop to Windows XP Professional.  When you  remote desktop to a Windows Server 2003 computer, the default is to  start a new session.</p>
<p>This is how you can connect to the default/console/admin session:<br />
Create a .bat file like this:</p>
<p><span style="font-family: Courier New;">%SystemRoot%\system32\mstsc.exe &#8220;You RDP file&#8221; /admin</span></p>
<p>For options just run<br />
<span style="font-family: Courier New;">%SystemRoot%\system32\mstsc.exe /?<br />
</span><br />
<a href="http://weblogs.asp.net/jeffwids/archive/2005/12/14/remote-desktop-to-console-session-on-windows-server-2003.aspx">This post</a> is a good reference</p>
]]></content:encoded>
			<wfw:commentRss>http://pranas.net/2010/04/remote-desktop-to-console-admin-session-on-windows-server-2003/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating a Self-Signed SSL Certificate without a mess of makecert.exe (using SSL Diagnostics Tool)</title>
		<link>http://pranas.net/2008/12/creating-a-self-signed-ssl-certificate-without-a-mess-of-makecert-exe-using-ssl-diagnostics-tool/</link>
		<comments>http://pranas.net/2008/12/creating-a-self-signed-ssl-certificate-without-a-mess-of-makecert-exe-using-ssl-diagnostics-tool/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 01:12:01 +0000</pubDate>
		<dc:creator>Ruslan Sudentas</dc:creator>
				<category><![CDATA[Random Thoughts]]></category>

		<guid isPermaLink="false">http://iodine-125.com/?p=79</guid>
		<description><![CDATA[Introduction: 
So you have a server and you need to implement SSL to allow secure (https) communication. What choices do you have? You can buy a certificate from certification authority or you can issue a Self-Signed certificate to yourself. The difference is that your browser &#8220;knows&#8221; it can trust the certificates from the authorities (it [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction: </strong></p>
<p>So you have a server and you need to implement SSL to allow secure (https) communication. What choices do you have? You can buy a certificate from certification authority or you can issue a Self-Signed certificate to yourself. The difference is that your browser &#8220;knows&#8221; it can trust the certificates from the authorities (it has it installed). But when the browser encounters the https connection with a server with the self-signed certificate, the user is presented with a message like this:</p>
<p><img class="size-full wp-image-80" title="SSLDiagnostics_SecurityAlert" src="/wp-content/uploads/SSLDiagnostics_SecurityAlert.JPG" alt="SSLDiagnostics_SecurityAlert" width="385" height="308" /></p>
<p>Thus, self-signed certificates are OK for test and development web sites, but generally not OK for public websites.</p>
<p>This article will show you the simplest ways to create a Self-Signed SSL Certificate.</p>
<p>Here are your options. (Or just <a href="#BestSolution">go to the Best Solution </a>)</p>
<p><strong>Solution 1 </strong> (quite long, but recommended by Microsoft)</p>
<p><strong>Setting Up SSL Using IIS and Certificate Server </strong></p>
<p>MS recommends that you get the certificate from the certificate server. This means that you have to have an access to Window 2000 or Windows 2003 server with &#8220;Certification Services&#8221; installed. You use IIS MMC to generate request to this server. Then using browser you submit this request to the server. Then, when somebody at that server approves the request, you will get back a certificate.</p>
<p>See details at <a href="http://support.microsoft.com/default.aspx?kbid=299525">http://support.microsoft.com/default.aspx?kbid=299525 </a></p>
<p><strong>Solution 2 </strong> (fast, but sometimes could be tricky)</p>
<p><strong>Creating Self-Signed SSL Certificates using makecert.exe</strong></p>
<p><strong> </strong>It is a quite simple solution. The only problem is that sometimes it just doesn&#8217;t work, and it&#8217;s hard to determine what is wrong. The makecert.exe comes with VS.NET. It you don&#8217;t have .NET Framework 1.1 installed, the makecert might be outdated. You can download a newer version from <a href="http://download.microsoft.com/download/platformsdk/Update/5.131.3617.0/NT45XP/EN-US/makecert.exe">http://download.microsoft.com/download/platformsdk/Update/5.131.3617.0/NT45XP/EN-US/makecert.exe </a></p>
<p>Just replace <em>yourservername </em> with the computer name of your PC and run:</p>
<p>makecert -r -pe -n &#8220;CN=<em>yourservername</em>&#8221; -b 01/01/2000 -e 01/01/2050 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sp &#8220;Microsoft RSA SChannel Cryptographic Provider&#8221; -sy 12</p>
<p>Then go to the IIS &#8220;Web Site Properties&#8221;, &#8220;Directory Security&#8221;, &#8220;Server Certificate&#8230;&#8221;, &#8220;Assign an existing certificate&#8221; and select the new certificate from the list.</p>
<p>It works? Fine! No? <a href="#BestSolution">Go to the Best Solution </a></p>
<p><strong>Solution 3 </strong> (OK for not-technical users)</p>
<p><strong>Download a test certificate from certification authorities</strong></p>
<p><strong></strong>The certificate companies like VeriSign and Thawte issue test certificates, but they expire after 90 days or so, and the process of getting it could be quite tedious.</p>
<p><a name="BestSolution"></a><strong>Solution 4 </strong><span class="style4">(The Best and Recommended) </span></p>
<p><strong>Create a Self-Signed Certificate using <a name="windowsQA_1"></a>SSL Diagnostics Tool </strong></p>
<p>Avoid all this pain with a nice tool from Microsoft: <strong>SSL Diagnostics </strong>. Download setup.exe (2112 KB) from here: <a href="http://www.microsoft.com/downloads/details.aspx?familyid=CABEA1D0-5A10-41BC-83D4-06C814265282&amp;displaylang=en">http://www.microsoft.com/downloads/details.aspx?familyid=CABEA1D0-5A10-41BC-83D4-06C814265282&amp;displaylang=en </a></p>
<p>Install it and run. In the main window of SSL Diagnostics, right-click the Web site level (shown by [W3SVC/&lt;site number&gt;]), and then click Create New Certificate.</p>
<p><img class="size-full wp-image-81" title="SSLDiagnostics_SSLDiag" src="/wp-content/uploads/SSLDiagnostics_SSLDiag.JPG" alt="SSLDiagnostics_SSLDiag" width="451" height="422" /></p>
<p>That is it. You are done. Don&#8217;t forget to explore other capabilities of this nice tool.</p>
]]></content:encoded>
			<wfw:commentRss>http://pranas.net/2008/12/creating-a-self-signed-ssl-certificate-without-a-mess-of-makecert-exe-using-ssl-diagnostics-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Writing to Event Log in ASP.NET application</title>
		<link>http://pranas.net/2008/12/writing-to-event-log-in-asp-net-application/</link>
		<comments>http://pranas.net/2008/12/writing-to-event-log-in-asp-net-application/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 01:05:19 +0000</pubDate>
		<dc:creator>Ruslan Sudentas</dc:creator>
				<category><![CDATA[Random Thoughts]]></category>

		<guid isPermaLink="false">http://iodine-125.com/?p=77</guid>
		<description><![CDATA[Writing to Event Log is not simple, but very simple:
// Create an EventLog instance and assign its source.
EventLog
        myLog = new EventLog();
myLog.Source
        = &#34;MySource&#34;;
&#160;
// Write an informational entry to the event log.   
        
myLog.WriteEntry(&#34;Writing
  [...]]]></description>
			<content:encoded><![CDATA[<p>Writing to Event Log is not simple, but very simple:</p>
<p style='text-autospace:none'><span style='font-family:"Courier New";<br />
color:green'>// Create an EventLog instance and assign its source.</span></p>
<p style='text-autospace:none'><span style='font-family:"Courier New"'>EventLog<br />
        myLog = <span style='color:blue'>new</span> EventLog();</span></p>
<p style='text-autospace:none'><span style='font-family:"Courier New"'>myLog.Source<br />
        = &quot;MySource&quot;;</span></p>
<p style='text-autospace:none'><span style='font-family:"Courier New"'>&nbsp;</span></p>
<p style='text-autospace:none'><span style='font-family:"Courier New";<br />
color:green'>// Write an informational entry to the event log.   <br />
        </span></p>
<p style='text-autospace:none'><span style='font-family:"Courier New"'>myLog.WriteEntry(&quot;Writing<br />
        to event log.&quot;);</span></p>
<p>EventLog is in System.Diagnostics namespase.</p>
<p>Before using the source of the EventLog, you have to create<br />
        it. But if you use the code like this:</p>
<p style='text-autospace:none'><span style='font-family:"Courier New";<br />
color:green'>//Create Event Log if It Doesn&#8217;t Exist </span></p>
<p style='text-autospace:none'><span style='font-family:"Courier New";<br />
color:blue'>if</span><span style='font-family:"Courier New"'> (! EventLog.SourceExists(&quot;MySource&quot;)) </span></p>
<p style='text-autospace:none'><span style='font-family:"Courier New"'>      EventLog.CreateEventSource(&quot;MySource&quot;,<br />
        &quot;MySource&quot;);</span></p>
<p>you will get the error:</p>
<p>System.Security.SecurityException: Requested registry access<br />
        is not allowed.</p>
<p>Instead, go to registry editor (regedit), locate key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application<br />
        and create a new key with the source name</p>
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://pranas.net/2008/12/writing-to-event-log-in-asp-net-application/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hierarchical Data Binding in ASP.NET</title>
		<link>http://pranas.net/2008/12/hierarchical-data-binding-in-asp-net/</link>
		<comments>http://pranas.net/2008/12/hierarchical-data-binding-in-asp-net/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 01:03:04 +0000</pubDate>
		<dc:creator>Ruslan Sudentas</dc:creator>
				<category><![CDATA[Random Thoughts]]></category>

		<guid isPermaLink="false">http://iodine-125.com/?p=74</guid>
		<description><![CDATA[This will show a sample of hierarchical data bound to
				hierarchical List Controls (repeaters)
&#160;
This is just a transcript of the great article by Fritz Onion
				from  http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspn-hierdatabinding.asp
    
&#160;
Get the data
This is obvious
&#160;
//Create DataSet and Bind it to the
repeater
private
    void Page_Load(object sender, EventArgs e)
{
&#160;&#160;&#160;&#160;&#160;
        [...]]]></description>
			<content:encoded><![CDATA[<p>This will show a sample of hierarchical data bound to<br />
				hierarchical List Controls (repeaters)</p>
<p>&nbsp;</p>
<p>This is just a transcript of the great article by Fritz Onion<br />
				from <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspn-hierdatabinding.asp"> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspn-hierdatabinding.asp</a>
    </p>
<p>&nbsp;</p>
<h2>Get the data</h2>
<p>This is obvious</p>
<p>&nbsp;</p>
<p><span style="FONT-SIZE:10pt;<br />
COLOR:green;<br />
FONT-FAMILY:'Courier New'">//Create DataSet and Bind it to the<br />
repeater</span></p>
<p><span style="FONT-SIZE:10pt;<br />
COLOR:blue;<br />
FONT-FAMILY:'Courier New'">private</span><span style="FONT-SIZE:<br />
10pt;FONT-FAMILY:<br />
'Courier New'"><br />
    <span style='COLOR:blue'>void</span> Page_Load(<span style='COLOR:blue'>object</span> sender, EventArgs e)</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">{</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:blue'>string</span> strConn<br />
= </span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;server=.;trusted_connection=yes;database=northwind&#8221;;</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'"></span>&nbsp;</p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:blue'>string</span> strSql&nbsp;<br />
= &#8220;SELECT CustomerID, CompanyName FROM &#8221; +</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&#8221; Customers;<br />
&#8220;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&#8220;SELECT OrderID, CustomerID,<br />
&#8220;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;+ </span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&#8220;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EmployeeID FROM<br />
Orders;&#8221;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;SELECT OrderID,<br />
Products.ProductID,&#8221;&nbsp; +</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;ProductName, Products.UnitPrice<br />
FROM&#8221; +</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8221; [Order Details], Products WHERE<br />
&#8220;&nbsp;&nbsp;&nbsp; +</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&#8221; [Order Details].ProductID =<br />
&#8220;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; +</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;Products.ProductID&#8221;;</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'"></span>&nbsp;</p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SqlConnection conn = <span style='COLOR:blue'>new</span> SqlConnection(strConn);</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SqlDataAdapter da = <span style='COLOR:blue'>new</span> SqlDataAdapter(strSql, conn);</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; da.TableMappings.Add(&#8220;Customers1&#8243;,<br />
&#8220;Orders&#8221;);</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; da.TableMappings.Add(&#8220;Customers2&#8243;,<br />
&#8220;OrderDetails&#8221;);</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'"></span>&nbsp;</p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:green'>//Fill DataSet</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _ds = <span style='COLOR:blue'>new</span> DataSet();</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; da.Fill(_ds, &#8220;Customers&#8221;);</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'"></span>&nbsp;</p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:green'>//Add Relations</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _ds.Relations.Add(&#8220;Customer_Order&#8221;, </span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _ds.Tables["Customers"].Columns["CustomerID"], </span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _ds.Tables["Orders"].Columns["CustomerID"]);</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _ds.Relations[0].Nested = <span style='COLOR:blue'>true</span>;</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _ds.Relations.Add(&#8220;Order_OrderDetail&#8221;, </span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _ds.Tables["Orders"].Columns["OrderID"], </span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _ds.Tables["OrderDetails"].Columns["OrderID"]);</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _ds.Relations[1].Nested = <span style='COLOR:blue'>true</span>;</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'"></span>&nbsp;</p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:green'>//Bind</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _customerRepeater.DataSource =<br />
_ds.Tables["Customers"];</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _customerRepeater.DataBind();</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">}</span></p>
<p>&nbsp;</p>
<h2>Very useful function</h2>
<p><span style="FONT-SIZE:10pt;<br />
COLOR:gray;<br />
FONT-FAMILY:'Courier New'">///</span><span style="FONT-SIZE:10pt;<br />
COLOR:green;<br />
FONT-FAMILY:'Courier New'"></span><span style="FONT-SIZE:10pt;<br />
COLOR:gray;<br />
FONT-FAMILY:'Courier New'">&lt;summary&gt;</span></p>
<p><span style="FONT-SIZE:10pt;<br />
COLOR:gray;<br />
FONT-FAMILY:'Courier New'">///</span><span style="FONT-SIZE:10pt;<br />
COLOR:green;<br />
FONT-FAMILY:'Courier New'"> returns a DataView of ChildRows</span></p>
<p><span style="FONT-SIZE:10pt;<br />
COLOR:gray;<br />
FONT-FAMILY:'Courier New'">///</span><span style="FONT-SIZE:10pt;<br />
COLOR:green;<br />
FONT-FAMILY:'Courier New'"></span><span style="FONT-SIZE:10pt;<br />
COLOR:gray;<br />
FONT-FAMILY:'Courier New'">&lt;/summary&gt;</span></p>
<p><span style="FONT-SIZE:10pt;<br />
COLOR:gray;<br />
FONT-FAMILY:'Courier New'">///</span><span style="FONT-SIZE:10pt;<br />
COLOR:green;<br />
FONT-FAMILY:'Courier New'"></span><span style="FONT-SIZE:10pt;<br />
COLOR:gray;<br />
FONT-FAMILY:'Courier New'">&lt;param name=&#8221;dataItem&#8221;&gt;</span><span style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New'">parent row</span><span style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New'">&lt;/param&gt;</span></p>
<p><span style="FONT-SIZE:10pt;<br />
COLOR:gray;<br />
FONT-FAMILY:'Courier New'">///</span><span style="FONT-SIZE:10pt;<br />
COLOR:green;<br />
FONT-FAMILY:'Courier New'"></span><span style="FONT-SIZE:10pt;<br />
COLOR:gray;<br />
FONT-FAMILY:'Courier New'">&lt;param name=&#8221;relation&#8221;&gt;</span><span style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New'">the name of the<br />
relation</span><span style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New'">&lt;/param&gt;</span></p>
<p><span style="FONT-SIZE:10pt;<br />
COLOR:gray;<br />
FONT-FAMILY:'Courier New'">///</span><span style="FONT-SIZE:10pt;<br />
COLOR:green;<br />
FONT-FAMILY:'Courier New'"></span><span style="FONT-SIZE:10pt;<br />
COLOR:gray;<br />
FONT-FAMILY:'Courier New'">&lt;returns&gt;</span><span style="FONT-SIZE:10pt;COLOR:green;FONT-FAMILY:'Courier New'">DataView</span><span style="FONT-SIZE:10pt;COLOR:gray;FONT-FAMILY:'Courier New'">&lt;/returns&gt;</span></p>
<p><span style="FONT-SIZE:10pt;<br />
COLOR:blue;<br />
FONT-FAMILY:'Courier New'">protected</span><span style="FONT-SIZE:<br />
10pt;FONT-FAMILY:<br />
'Courier New'"> DataView GetChildRelation(<span style='COLOR:blue'>object</span> dataItem, </span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:blue'>string</span> relation)</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">{</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DataRowView drv = dataItem <span style='COLOR:blue'>as</span> DataRowView;</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:blue'>if</span> (drv != <span style='COLOR:blue'>null</span>)</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:blue'>return</span> drv.CreateChildView(relation);</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:blue'>else</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:blue'>return</span><br />
        <span style='COLOR:blue'>null</span>;</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">}</span></p>
<p>&nbsp;</p>
<h2>HTML view</h2>
<p>Three hierarchical repeaters:</p>
<p>&nbsp;</p>
<p><span style="FONT-SIZE:10pt;<br />
COLOR:blue;<br />
FONT-FAMILY:'Courier New'">&lt;</span><span style="FONT-SIZE:10pt;<br />
COLOR:maroon;<br />
FONT-FAMILY:'Courier New'">asp:Repeater</span><span style="FONT-SIZE:10pt;COLOR:fuchsia;FONT-FAMILY:'Courier New'"></span><span style="FONT-SIZE:10pt;COLOR:red;FONT-FAMILY:'Courier New'">Runat</span><span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New'">=&#8221;server&#8221;</span><span style="FONT-SIZE:10pt;COLOR:fuchsia;FONT-FAMILY:'Courier New'"></span><span style="FONT-SIZE:10pt;COLOR:red;FONT-FAMILY:'Courier New'">ID</span><span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New'">=&#8221;_customerRepeater&#8221;</span><span style="FONT-SIZE:10pt;COLOR:fuchsia;FONT-FAMILY:'Courier New'"></span></p>
<p><span style="FONT-SIZE:10pt;<br />
COLOR:fuchsia;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span><span style="FONT-SIZE:<br />
10pt;COLOR:<br />
red;FONT-FAMILY:<br />
'Courier New'">EnableViewState</span><span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New'">=&#8221;false&#8221;&gt;</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;<br />
        <span style='COLOR:blue'>&lt;</span><span style='COLOR:maroon'>ItemTemplate</span><span style='COLOR:blue'>&gt;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp; Customer:</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;<br />
        <span style='BACKGROUND:yellow'>&lt;%</span>#<br />
DataBinder.Eval(Container.DataItem, &#8220;CustomerID&#8221;) <span style='BACKGROUND:yellow'>%&gt;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;<br />
        <span style='COLOR:red'>&amp;nbsp;</span><br />
        <span style='COLOR:red'>&amp;nbsp;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;<br />
        <span style='BACKGROUND:yellow'>&lt;%</span>#<br />
DataBinder.Eval(Container.DataItem,&#8221;CompanyName&#8221;) <span style='BACKGROUND:yellow'>%&gt;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:blue'>&lt;</span><span style='COLOR:maroon'>br</span><span style='COLOR:fuchsia'></span><span style='COLOR:blue'>/&gt;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:blue'>&lt;</span><span style='COLOR:maroon'>asp:Repeater</span><span style='COLOR:fuchsia'></span><span style='COLOR:red'>runat</span><span style='COLOR:blue'>=&#8221;server&#8221;</span><span style='COLOR:fuchsia'></span><span style='COLOR:red'>EnableViewState</span><span style='COLOR:blue'>=&#8221;false&#8221;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
COLOR:fuchsia;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span><span style="FONT-SIZE:10pt;COLOR:red;FONT-FAMILY:'Courier New'">DataSource</span><span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New'">=</span></p>
<p><span style="FONT-SIZE:10pt;<br />
COLOR:fuchsia;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span><span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New'">&#8216;</span><span style="FONT-SIZE:10pt;BACKGROUND:yellow;FONT-FAMILY:'Courier New'">&lt;%</span><span style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New'"># GetChildRelation(Container.DataItem, </span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&#8220;Customer_Order&#8221;)<span style='BACKGROUND:yellow'>%&gt;</span><span style='COLOR:blue'>&#8216;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
COLOR:fuchsia;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;<br />
</span><span style="FONT-SIZE:<br />
10pt;COLOR:<br />
red;FONT-FAMILY:<br />
'Courier New'">ID</span><span style="FONT-SIZE:<br />
10pt;COLOR:<br />
blue;FONT-FAMILY:<br />
'Courier New'">=&#8221;Repeater1&#8243;&gt;</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:blue'>&lt;</span><span style='COLOR:maroon'>itemTemplate</span><span style='COLOR:blue'>&gt;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:red'>&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Orderid:<span style='COLOR:blue'>&lt;</span><span style='COLOR:maroon'>b</span><span style='COLOR:blue'>&gt;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='BACKGROUND:yellow'>&lt;%</span>#DataBinder.Eval(Container.DataItem,<br />
&#8220;OrderID&#8221;)<span style='BACKGROUND:yellow'>%&gt;</span><br />
</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:blue'>&lt;/</span><span style='COLOR:maroon'>b</span><span style='COLOR:blue'>&gt;&lt;</span><span style='COLOR:maroon'>br</span><span style='COLOR:blue'>/&gt;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:blue'>&lt;</span><span style='COLOR:maroon'>asp:Repeater</span><span style='COLOR:fuchsia'></span><span style='COLOR:red'>runat</span><span style='COLOR:blue'>=&#8221;server&#8221;</span><span style='COLOR:fuchsia'></span><span style='COLOR:red'>EnableViewState</span><span style='COLOR:blue'>=&#8221;false&#8221;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
COLOR:fuchsia;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span><span style="FONT-SIZE:10pt;COLOR:red;FONT-FAMILY:'Courier New'">DataSource</span><span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New'">=</span></p>
<p><span style="FONT-SIZE:10pt;<br />
COLOR:fuchsia;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span><span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New'">&#8216;</span><span style="FONT-SIZE:10pt;BACKGROUND:yellow;FONT-FAMILY:'Courier New'">&lt;%</span><span style="FONT-SIZE:10pt;FONT-FAMILY:'Courier New'">#<br />
GetChildRelation(Container.DataItem, </span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&#8220;Order_OrderDetail&#8221;)<span style='BACKGROUND:yellow'>%&gt;</span><span style='COLOR:blue'>&#8216;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
COLOR:fuchsia;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
</span><span style="FONT-SIZE:<br />
10pt;COLOR:<br />
red;FONT-FAMILY:<br />
'Courier New'">ID</span><span style="FONT-SIZE:<br />
10pt;COLOR:<br />
blue;FONT-FAMILY:<br />
'Courier New'">=&#8221;Repeater2&#8243;&gt;</span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:blue'>&lt;</span><span style='COLOR:maroon'>itemTemplate</span><span style='COLOR:blue'>&gt;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:red'>&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:red'>&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:blue'>&lt;</span><span style='COLOR:maroon'>b</span><span style='COLOR:blue'>&gt;</span><span style='BACKGROUND:yellow'>&lt;%</span># DataBinder.Eval(Container.DataItem, </span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&#8220;ProductName&#8221;) <span style='BACKGROUND:yellow'>%&gt;</span><span style='COLOR:blue'>&lt;/</span><span style='COLOR:maroon'>b</span><span style='COLOR:blue'>&gt;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $<span style='BACKGROUND:yellow'>&lt;%</span>#<br />
DataBinder.Eval(Container.DataItem, </span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#8221;UnitPrice&#8221;) <span style='BACKGROUND:yellow'>%&gt;</span><br />
<span style='COLOR:blue'>&lt;</span><span style='COLOR:maroon'>br</span><span style='COLOR:blue'>/&gt;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:blue'>&lt;/</span><span style='COLOR:maroon'>itemTemplate</span><span style='COLOR:blue'>&gt;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:blue'>&lt;/</span><span style='COLOR:maroon'>asp:Repeater</span><span style='COLOR:blue'>&gt;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <span style='COLOR:blue'>&lt;/</span><span style='COLOR:maroon'>itemTemplate</span><span style='COLOR:blue'>&gt;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;&nbsp;<br />
        <span style='COLOR:blue'>&lt;/</span><span style='COLOR:maroon'>asp:Repeater</span><span style='COLOR:blue'>&gt;</span></span></p>
<p><span style="FONT-SIZE:10pt;<br />
FONT-FAMILY:'Courier New'">&nbsp;<span style='COLOR:blue'>&lt;/</span><span style='COLOR:maroon'>ItemTemplate</span><span style='COLOR:blue'>&gt;</span></span></p>
<p><span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New'">&lt;/</span><span style="FONT-SIZE:10pt;COLOR:maroon;FONT-FAMILY:'Courier New'">asp:Repeater</span><span style="FONT-SIZE:10pt;COLOR:blue;FONT-FAMILY:'Courier New'">&gt;</span></p>
]]></content:encoded>
			<wfw:commentRss>http://pranas.net/2008/12/hierarchical-data-binding-in-asp-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
