<?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>Compdigitec Labs &#187; Windows</title>
	<atom:link href="http://www.compdigitec.com/labs/category/win32/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.compdigitec.com/labs</link>
	<description>The place for interesting things</description>
	<lastBuildDate>Thu, 09 Feb 2012 03:08:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Solving &#8220;Only Content controls are allowed directly in a content page that contains Content controls&#8221;</title>
		<link>http://www.compdigitec.com/labs/2012/02/03/solving-only-content-controls-are-allowed-directly-in-a-content-page-that-contains-content-controls/</link>
		<comments>http://www.compdigitec.com/labs/2012/02/03/solving-only-content-controls-are-allowed-directly-in-a-content-page-that-contains-content-controls/#comments</comments>
		<pubDate>Sat, 04 Feb 2012 03:16:51 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[content controls]]></category>
		<category><![CDATA[master page]]></category>
		<category><![CDATA[user control.asp.net user control]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=265</guid>
		<description><![CDATA[While debugging and creating a new ASP.NET User Control, I stumbled across the following error, &#8220;Only Content controls are allowed directly in a content page that contains Content controls&#8221; that I did not encounter before. The culprit: an invalid assembly in the custom ASP.NET User Control registration section of &#8220;web.config&#8220;: The first thing I tried, [...]]]></description>
			<content:encoded><![CDATA[<p>While debugging and creating a new ASP.NET User Control, I stumbled across the following error, &#8220;<em>Only Content controls are allowed directly in a content page that contains Content controls</em>&#8221; that I did not encounter before. The culprit: an invalid assembly in the custom ASP.NET User Control registration section of &#8220;<em>web.config</em>&#8220;:</p>
<p>The first thing I tried, is, of course, to <a href="http://social.msdn.microsoft.com/forums/en-US/sharepointdevelopment/thread/de64e551-1441-4e1d-9956-277b352cd9b1">follow</a> <a href="http://www.codeproject.com/Questions/184240/Error-Only-content-controls-are-allowed-directly-i">the</a> <a href="http://www.fewlines4biju.com/2011/11/only-content-controls-are-allowed.html">advice</a> <a href="http://edinkapic.blogspot.com/2008/10/only-content-controls-are-allowed.html">on</a> <a href="http://stackoverflow.com/questions/679246/do-script-tags-and-link-tags-go-inside-aspcontent-or-outside">the</a> <a href="http://forums.asp.net/t/1579320.aspx/1">can</a> and remove any tag or text other than &#8220;&lt;asp:Content&gt;&#8221; tags from the page. But as, you can see, there are no other characters or tags on the page, and I had tried many times to regenerate the page or force VS to &#8220;re-parse&#8221; the page without success.</p>
<p><a href="http://www.compdigitec.com/labs/wp-content/uploads/2012/02/contenterror1.png"><img class="alignnone  wp-image-266" title="Only Content controls are allowed directly in a content page that contains Content controls" src="http://www.compdigitec.com/labs/wp-content/uploads/2012/02/contenterror1.png" alt="" width="653" height="388" /></a></p>
<p>After some more debugging for a while, I found this error, which was related to an invalid assembly in the registering custom ASP.NET User Controls section of the web.config document:</p>
<div id="attachment_267" class="wp-caption alignnone" style="width: 830px"><a href="http://www.compdigitec.com/labs/wp-content/uploads/2012/02/contenterror2.png"><img class=" wp-image-267 " title="Found another error" src="http://www.compdigitec.com/labs/wp-content/uploads/2012/02/contenterror2.png" alt="Found another error" width="820" height="388" /></a><p class="wp-caption-text">Found another error</p></div>
<p>And the answer? It turns out it was easy enough to fix after all, just fix the offending assembly reference!</p>
<div id="attachment_268" class="wp-caption alignnone" style="width: 566px"><a href="http://www.compdigitec.com/labs/wp-content/uploads/2012/02/contenterror3.png"><img class=" wp-image-268 " title="The culprit of the error, Only Content controls are allowed directly in a content page that contains Content controls" src="http://www.compdigitec.com/labs/wp-content/uploads/2012/02/contenterror3.png" alt="The culprit of the error, Only Content controls are allowed directly in a content page that contains Content controls" width="556" height="140" /></a><p class="wp-caption-text">The culprit of the error, Only Content controls are allowed directly in a content page that contains Content controls</p></div>
<p>And <em>voila</em>, fixed:</p>
<div id="attachment_269" class="wp-caption alignnone" style="width: 291px"><a href="http://www.compdigitec.com/labs/wp-content/uploads/2012/02/contenterror4.png"><img class="size-full wp-image-269" title="Fixed!" src="http://www.compdigitec.com/labs/wp-content/uploads/2012/02/contenterror4.png" alt="Fixed!" width="281" height="399" /></a><p class="wp-caption-text">Fixed!</p></div>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2012/02/03/solving-only-content-controls-are-allowed-directly-in-a-content-page-that-contains-content-controls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Launch non-exe extension files as executables</title>
		<link>http://www.compdigitec.com/labs/2011/05/01/launch-non-exe-extension-files-as-executables/</link>
		<comments>http://www.compdigitec.com/labs/2011/05/01/launch-non-exe-extension-files-as-executables/#comments</comments>
		<pubDate>Mon, 02 May 2011 00:07:39 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=221</guid>
		<description><![CDATA[Windows does not come with a built-in way of launching executables that are without the exe extension. However, we have written a small tool called &#8220;anylaunch&#8221; which allows one to execute any file as if it were an executable. (Non-PE files will still give an error since they are not executables &#8220;XYZ is not a [...]]]></description>
			<content:encoded><![CDATA[<p>Windows does not come with a built-in way of launching executables that are without the exe extension. However, we have written a small tool called &#8220;anylaunch&#8221; which allows one to execute any file as if it were an executable. (Non-PE files will still give an error since they are not executables &#8220;XYZ is not a valid Win32 application&#8221;)</p>
<p>Download (<a href="/labs/files/anylaunch.exe">anylaunch.exe</a>) or compile from source below:</p>
<pre class="brush: cpp; title: ; notranslate">
#include &lt;iostream&gt;
#include &lt;windows.h&gt;
#include &lt;cstdlib&gt;
//#define ZeroMemory(p,size) memset((p),0,(size))
using namespace std;

int main(int argc, char* argv[])
{
	if(argc-1 &lt; 1) {
		cout &lt;&lt; &quot;No process specified&quot; &lt;&lt; endl;
		return 0;
	}

	STARTUPINFO si;
	PROCESS_INFORMATION pi;
	// must blank it
	memset(&amp;si,0,sizeof(si));
	si.cb = sizeof(si);
	si.lpReserved = NULL;
	si.lpTitle = NULL;
	// required for GUI app
	si.dwFlags = STARTF_USESHOWWINDOW;
	si.wShowWindow = SW_MINIMIZE;

	bool res = CreateProcess(NULL,argv[1],NULL,NULL,FALSE,0,NULL,NULL,&amp;si,&amp;pi);
	if(res == false) {
		printf(&quot;CreateProcess failed (error code %d)\n&quot;, GetLastError());
		return 1;
	}

	CloseHandle(pi.hProcess);
	CloseHandle(pi.hThread);
	return 0;
}
</pre>
<p>Download or compile the anylaunch executable and put it into the same directory as your script or into the system directory. You can use it in a command line, batch scripting or another program like so:<br />
<b>anylaunch &#8220;&lt;process command line here&gt;&#8221;</b></p>
<p><b>Simple examples (assuming anylaunch is in system path or current folder):</b></p>
<ul>
<li>Launching global executable
<pre class="brush: plain; title: ; notranslate">anylaunch explorer</pre>
</li>
<li>Launch executable in specific path
<pre class="brush: plain; title: ; notranslate">anylaunch &quot;C:\\Tools\\wget.exe http://example.com&quot;</pre>
</li>
</ul>
<p>Although the biggest use of this tool is to launch non-exe PE files, like so:</p>
<pre class="brush: bash; title: ; notranslate">file yes.123</pre>
<p>yes.123: PE32 executable for MS Windows (GUI) Intel 80386 32-bit<br />
Then we can use anylaunch to launch this PE file:</p>
<pre class="brush: bash; title: ; notranslate">anylaunch yes.123</pre>
<div id="attachment_222" class="wp-caption aligncenter" style="width: 410px"><a href="http://www.compdigitec.com/labs/wp-content/uploads/2011/05/process.png"><img src="http://www.compdigitec.com/labs/wp-content/uploads/2011/05/process.png" alt="Non-exe process in Task Manager" title="Non-exe process in Task Manager" width="400" height="300" class="size-full wp-image-222" /></a><p class="wp-caption-text">Non-exe process in Task Manager</p></div>
<p>You may run into some problems while running this. If your command line arguments to your target application are not showing up, you should put your entire command line into one argument and escaping quotes (<b>anylaunch &#8220;C:\\Program Files\\Mozilla Firefox\\firefox.exe&#8221;</b> not <span style="text-decoration: line-through;"><b>anylaunch C:\Program Files\Mozilla Firefox\firefox.exe</b></span>). Some other common problems:</p>
<p>Accessing a file that does not exist or is inaccessible (The system cannot find the file specified.):</p>
<pre class="brush: bash; title: ; notranslate">cat somefile.rnd</pre>
<p>cat: somefile.rnd: No such file or directory</p>
<pre class="brush: bash; title: ; notranslate">anylaunch somefile.rnd</pre>
<p>CreateProcess failed (error code 2)</p>
<p>Trying to run an invalid Windows application</p>
<pre class="brush: bash; title: ; notranslate">file Untitled.png</pre>
<p>Untitled.png: PNG image, 800 x 600, 8-bit/color RGB, non-interlaced</p>
<pre class="brush: bash; title: ; notranslate">anylaunch.exe Untitled.png</pre>
<p>CreateProcess failed (error code 11) (An attempt was made to load a program with an incorrect format.)<br />
CreateProcess failed (error code 193) (%1 is not a valid Win32 application.)<br />
<em>etc&#8230; (invalid format error, or win32 errors, etc)</em></p>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2011/05/01/launch-non-exe-extension-files-as-executables/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Microsoft Word 2010 and colour depth</title>
		<link>http://www.compdigitec.com/labs/2011/02/05/microsoft-word-2010-and-colour-depth/</link>
		<comments>http://www.compdigitec.com/labs/2011/02/05/microsoft-word-2010-and-colour-depth/#comments</comments>
		<pubDate>Sat, 05 Feb 2011 22:30:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[colour depth]]></category>
		<category><![CDATA[microsoft word]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[word]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=210</guid>
		<description><![CDATA[Normally, the appearance of the Office 2010 application on the Windows operating system is the one with a high colour depth with the modern icons. However, if you are accessing an Office 2010 application through a remote access application like VNC or Remote Desktop or if you have a graphics card which is not capable [...]]]></description>
			<content:encoded><![CDATA[<p>Normally, the appearance of the Office 2010 application on the Windows operating system is the one with a high colour depth with the modern icons. However, if you are accessing an Office 2010 application through a remote access application like VNC or Remote Desktop or if you have a graphics card which is not capable of supporting high colour or higher or if the graphics card is misconfigured, then you might end up with a really &#8220;classic&#8221; look in Microsoft Word using Office 2000-style icons and a low colour scheme:</p>
<div id="attachment_211" class="wp-caption alignleft" style="width: 826px"><a href="http://www.compdigitec.com/labs/wp-content/uploads/2011/02/word_lowcolour.png"><img class="size-full wp-image-211 " title="Microsoft Word in low colour" src="http://www.compdigitec.com/labs/wp-content/uploads/2011/02/word_lowcolour.png" alt="Microsoft Word in low colour" width="816" height="381" /></a><p class="wp-caption-text">Microsoft Word in low colour</p></div>
<p>To restore the appearance to the full colour style, simply set the colour depth of the operating system to 16-bit or higher by right clicking on the Desktop, selecting Properties and going to the Settings tab, or by selecting Display Resolution, Advanced and going to the Monitor tab. If you want to trigger this look, simply set your colour depth using the same method to 256 colours, and you should be all set.</p>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2011/02/05/microsoft-word-2010-and-colour-depth/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Quickly generate CRUD (Create, read, update, delete) stored procedures in SSMS with SSMS Tools Pack</title>
		<link>http://www.compdigitec.com/labs/2010/12/23/quickly-generate-crud-stored-procs-in-ssms-with-ssms-tools-pack/</link>
		<comments>http://www.compdigitec.com/labs/2010/12/23/quickly-generate-crud-stored-procs-in-ssms-with-ssms-tools-pack/#comments</comments>
		<pubDate>Thu, 23 Dec 2010 22:18:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[crud]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[ssms]]></category>
		<category><![CDATA[stored procedures]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=203</guid>
		<description><![CDATA[Normally, in SQL Server Management Studio to generate some stored procedures one would have to go through series of dialogs and manual actions using the &#8220;Script To&#8221; menu. This process is both painful to do by hand and is also very error-prone. Now there is an automated tool that can automate the process of writing [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignnone" style="width: 624px"><a href="/images/labs/ssms.png"><img title="SSMS Tools Pack generated CRUD" src="/images/labs/ssms.png" alt="SSMS Tools Pack generated CRUD" width="614" height="424" /></a><p class="wp-caption-text">SSMS Tools Pack generated CRUD</p></div>
<p>Normally, in <strong>SQL Server Management Studio</strong> to generate some stored procedures one would have to go through series of dialogs and manual actions using the &#8220;Script To&#8221; menu. This process is both painful to do by hand and is also very error-prone. Now there is an automated tool that can automate the process of writing stored procedures for us - <a href="http://www.ssmstoolspack.com/">SSMS Tools Pack</a>.</p>
<p>To automatically generate the select, insert, update and delete procedures all one must do (after installing the free add-on), is right click on a table, go to &#8220;<strong>SSMS Tools</strong>&#8221; and &#8220;<strong>Generate CRUD</strong>&#8220;, and then <strong>Execute</strong> the query that it generates. This makes database development much easier compared to doing it by hand.</p>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2010/12/23/quickly-generate-crud-stored-procs-in-ssms-with-ssms-tools-pack/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Converting between int and std::string in C++</title>
		<link>http://www.compdigitec.com/labs/2010/11/20/converting-between-int-and-string-in-c/</link>
		<comments>http://www.compdigitec.com/labs/2010/11/20/converting-between-int-and-string-in-c/#comments</comments>
		<pubDate>Sat, 20 Nov 2010 21:09:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[cpp]]></category>
		<category><![CDATA[int]]></category>
		<category><![CDATA[std string]]></category>
		<category><![CDATA[string]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=196</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<pre class="brush: cpp; title: ; notranslate">
#include &lt;iostream&gt;
#include &lt;sstream&gt;
#include &lt;cstdlib&gt;
using namespace std;

int main() {
	// convert int to string
	int some_int = 52;
	stringstream ss;
	ss &lt;&lt; some_int;
	string result_s;
	ss &gt;&gt; result_s;
	// result_s = 52
	cout &lt;&lt; result_s &lt;&lt; endl;

	// convert string to int
	string some_string = &quot;1234&quot;;
	int result_i = atoi(some_string.c_str());
	// result_i = 1234
	cout &lt;&lt; result_i &lt;&lt; endl;
}
</pre>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2010/11/20/converting-between-int-and-string-in-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Connecting to a network Samba PDF converter</title>
		<link>http://www.compdigitec.com/labs/2010/09/30/connecting-to-a-network-samba-pdf-converter/</link>
		<comments>http://www.compdigitec.com/labs/2010/09/30/connecting-to-a-network-samba-pdf-converter/#comments</comments>
		<pubDate>Thu, 30 Sep 2010 23:44:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[converter]]></category>
		<category><![CDATA[drivers]]></category>
		<category><![CDATA[hp laserjet]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=185</guid>
		<description><![CDATA[The Samba team does not supply any existing PDF drivers for connecting Windows machines to networked PDF converters such as cups-pdf. As a result, the technique to print to the PDF &#8220;printer&#8221; involves using the drivers for the built-in Windows HP LaserJet. Here is a step-by-step method to print to PDF from your Windows computer. [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://www.samba.org/">Samba team</a> does not supply any existing PDF drivers for connecting Windows machines to networked PDF converters such as cups-pdf. As a result, the technique to print to the PDF &#8220;printer&#8221; involves using the drivers for the built-in Windows HP LaserJet. Here is a step-by-step method to print to PDF from your Windows computer.</p>
<p><strong>Prerequisites</strong></p>
<p>A set-up, ready to connect networked virtual PDF converter. This article will only cover connecting, not setting it up.</p>
<p><strong>Procedure</strong></p>
<ol>
<li>Open the &#8220;Add Printer&#8221; dialogue in Windows. Specify Network printer when asked.</li>
<li>Fill out the path to your networked PDF printer as follows: <strong>\\&lt;hostname&gt;\&lt;Printer name&gt;</strong><br />
<strong><a href="../wp-content/uploads/2010/10/connect_pdf1.png"><img class="size-full wp-image-186 alignleft" title="Printer Name" src="../wp-content/uploads/2010/10/connect_pdf1.png" alt="" width="302" height="231" /></a></strong></li>
<li>Click &#8220;Yes&#8221; and &#8220;OK&#8221; for the next two warning from Windows.<a href="http://www.compdigitec.com/labs/wp-content/uploads/2010/10/connect_pdf2.png"><img class="size-full wp-image-187 alignright" title="Connecting to Printer" src="http://www.compdigitec.com/labs/wp-content/uploads/2010/10/connect_pdf2.png" alt="" width="498" height="71" /></a></li>
<li>Select the HP LaserJet printer driver as shown as follows:<br />
<a href="http://www.compdigitec.com/labs/wp-content/uploads/2010/10/connect_pdf3.png"><img class="alignleft size-full wp-image-188" title="HP LaserJet Drivers" src="http://www.compdigitec.com/labs/wp-content/uploads/2010/10/connect_pdf3.png" alt="" width="441" height="322" /></a></li>
<li>After the driver installs, set it as your default printer in Windows or not and print a page to it. You can find the results in your cups-pdf output folder (usually /home/&lt;username&gt;/PDF and /var/spool/cups-pdf/ANONYMOUS for anonymous jobs)</li>
</ol>
<p><a href="http://www.compdigitec.com/labs/wp-content/uploads/2010/10/connect_pdf4.png"><img class="alignleft size-full wp-image-189" title="Print Test Page" src="http://www.compdigitec.com/labs/wp-content/uploads/2010/10/connect_pdf4.png" alt="" width="637" height="350" /></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2010/09/30/connecting-to-a-network-samba-pdf-converter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.NET GridView All-In-One Quick Reference</title>
		<link>http://www.compdigitec.com/labs/2010/07/17/asp-net-gridview-all-in-one-quick-reference/</link>
		<comments>http://www.compdigitec.com/labs/2010/07/17/asp-net-gridview-all-in-one-quick-reference/#comments</comments>
		<pubDate>Sun, 18 Jul 2010 01:21:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTTP (Internet)]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[aspnet]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[data]]></category>
		<category><![CDATA[display data]]></category>
		<category><![CDATA[gridview]]></category>
		<category><![CDATA[net]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=178</guid>
		<description><![CDATA[Here is a quick collection of snippets where one can quickly lookup the necessities of setting up a GridView for the purposes of displaying information to the viewer through a database (for example, MySQL): Adding Columns of Data Binding the Data (and storage across sessions) Paging Note: This needs AllowPaging to be set to &#8220;true&#8221;. [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a quick collection of snippets where one can quickly lookup the necessities of setting up a GridView for the purposes of displaying information to the viewer through a database (for example, MySQL):</p>
<p><strong>Adding Columns of Data</strong></p>
<pre class="brush: csharp; title: ; notranslate">
DataTable dt = new DataTable(&quot;Tablename&quot;);
dt.Columns.Add(&quot;Column1&quot;);
dt.Columns.Add(&quot;Column2&quot;);
dt.Columns.Add(&quot;Column3&quot;);
// for every row
DataRow dr = dt.NewRow();
dr[&quot;Column1&quot;] = &quot;Testing&quot;;
dr[&quot;Column2&quot;] = &quot;Blah&quot;;
dr[&quot;Column3&quot;] = &quot;Big Blah&quot;;
dt.Rows.Add(dr);
</pre>
<p><strong>Binding the Data (and storage across sessions)</strong></p>
<pre class="brush: csharp; title: ; notranslate">
DataView dv = new DataView(dt);
Session[&quot;data&quot;] = dv;
gridviewctrl.DataSource = dv;
gridviewctrl.DataBind();
</pre>
<p><strong>Paging</strong><br />
Note: This needs AllowPaging to be set to &#8220;true&#8221;. The following code goes in the &#8220;PageIndexChanging&#8221; callback.</p>
<pre class="brush: csharp; title: ; notranslate">
gridviewctrl.PageIndex = e.NewPageIndex;
gridviewctrl.DataSource = Session[&quot;data&quot;];
gridviewctrl.DataBind();
</pre>
<p><strong>Sorting</strong><br />
Note: This needs AllowSorting to be set to &#8220;true&#8221; and ensure all columns you want sorted have a &#8220;SortExpression&#8221; that matches the column name in the DataTable. The following code goes in the &#8220;Sorting&#8221; callback.</p>
<pre class="brush: csharp; title: ; notranslate">
string dir;
if (e.SortDirection == SortDirection.Ascending) {
    dir = &quot;ASC&quot;;
} else {
    dir = &quot;DESC&quot;;
}
((DataView)Session[&quot;Data&quot;]).Sort = e.SortExpression + &quot; &quot; + dir;
gridviewctrl.DataSource = Session[&quot;data&quot;];
gridviewctrl.DataBind();
</pre>
<p><strong>&lt;asp:ButtonField&gt;s</strong><br />
Create a &lt;asp:ButtonField&gt; declaration as follows: &lt;asp:ButtonField ButtonType=&#8221;Button&#8221; Text=&#8221;Button Text Here&#8221; CommandName=&#8221;DoSomething&#8221; /&gt;</p>
<pre class="brush: csharp; title: ; notranslate">
if (e.CommandName == &quot;DoSomething&quot;) {
    // get Index
    int index = Convert.ToInt32(e.CommandArgument);
    string test = ((DataView)Session[&quot;Data&quot;]).Table.Rows[index][&quot;Column1&quot;];
    Response.Redirect(&quot;http://www.google.com/search?q=&quot; + test.ToString()&quot;);
}
</pre>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2010/07/17/asp-net-gridview-all-in-one-quick-reference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solving Could not find stored procedure dbo.aspnet_CheckSchemaVersion in ASP.NET Membership</title>
		<link>http://www.compdigitec.com/labs/2010/07/13/solving-could-not-find-stored-procedure-dbo-aspnet_checkschemaversion-in-asp-net-membership/</link>
		<comments>http://www.compdigitec.com/labs/2010/07/13/solving-could-not-find-stored-procedure-dbo-aspnet_checkschemaversion-in-asp-net-membership/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 19:26:47 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[membership]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=176</guid>
		<description><![CDATA[Normally, as usual, one would not see the error Could not find stored procedure &#8216;dbo.aspnet_CheckSchemaVersion&#8217; if one has a good database already setup with everything good to go. However, sometime the annoying error Could not find stored procedure &#8216;dbo.aspnet_CheckSchemaVersion&#8217; crops up one can check the steps below to determine the root cause of the error: [...]]]></description>
			<content:encoded><![CDATA[<p>Normally, as usual, one would not see the error <strong>Could not find stored procedure &#8216;dbo.aspnet_CheckSchemaVersion&#8217;</strong> if one has a good database already setup with everything good to go. However, sometime the annoying error <strong>Could not find stored procedure &#8216;dbo.aspnet_CheckSchemaVersion&#8217;</strong> crops up one can check the steps below to determine the root cause of the error:</p>
<ol>
<li>Try to recreate the Memberships database (<strong>ASPNETDB</strong>) - it may be corrupt or inaccessible:
<pre class="brush: plain; title: ; notranslate">C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regsql -S . -E -A mrpc</pre>
</li>
<li>If that does not resolve the problem for you, the you should check in your <em>web.config</em> file to see if added &#8220;Initial Catalog=aspnetdb&#8221; somewhere in your web.config file like this:
<pre class="brush: plain; title: ; notranslate">Data source=.;Integrated Security=True;Initial Catalog=aspnetdb</pre>
</li>
<li>Restart IIS.</li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2010/07/13/solving-could-not-find-stored-procedure-dbo-aspnet_checkschemaversion-in-asp-net-membership/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Solving Handler &#8220;PageHandlerFactory-Integrated&#8221; has a bad module &#8220;ManagedPipelineHandler&#8221; in ASP.NET 4.0</title>
		<link>http://www.compdigitec.com/labs/2010/07/12/solving-handler-pagehandlerfactory-integrated-has-a-bad-module-managedpipelinehandler-in-asp-net-4-0/</link>
		<comments>http://www.compdigitec.com/labs/2010/07/12/solving-handler-pagehandlerfactory-integrated-has-a-bad-module-managedpipelinehandler-in-asp-net-4-0/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 18:36:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[.NET 4.0]]></category>
		<category><![CDATA[asp.net 4.0]]></category>
		<category><![CDATA[aspnet]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[dotnet]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[iis7]]></category>
		<category><![CDATA[managedpipelinehandler]]></category>
		<category><![CDATA[net]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=173</guid>
		<description><![CDATA[If you have just installed Visual Studio 2010 or the .NET 4.0 Framework and trying to host ASP.Net 4.0 applications doesn&#8217;t work for you and results in the following error message: Handler &#8220;PageHandlerFactory-Integrated&#8221; has a bad module &#8220;ManagedPipelineHandler&#8221; It means that you haven not yet run the aspnet_iisreg.exe executable needed to register the ASP.NET 4 [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.compdigitec.com/labs/wp-content/uploads/2010/07/badmodule.png"><img class="alignright size-full wp-image-174" title="Bad Module" src="http://www.compdigitec.com/labs/wp-content/uploads/2010/07/badmodule.png" alt="" width="614" height="446" /></a>If you have just installed Visual Studio 2010 or the .NET 4.0 Framework and trying to host ASP.Net 4.0 applications doesn&#8217;t work for you and results in the following error message:</p>
<p><strong>Handler &#8220;PageHandlerFactory-Integrated&#8221; has a bad module &#8220;ManagedPipelineHandler&#8221;</strong></p>
<p>It means that you haven not yet run the aspnet_iisreg.exe executable needed to register the ASP.NET 4 framework with the IIS 7 webserver. In order to do so, open a command prompt and type in the following:</p>
<pre class="brush: plain; title: ; notranslate">C:\windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i</pre>
<p>Substitute <strong>v4.0.30319</strong> for what other past or future ASP.NET versions. To uninstall the ASP.NET 4 (e.g. for when you are done playing around with it and would like to do some work):</p>
<pre class="brush: plain; title: ; notranslate">c:\windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -u</pre>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2010/07/12/solving-handler-pagehandlerfactory-integrated-has-a-bad-module-managedpipelinehandler-in-asp-net-4-0/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Solving &#8220;The name &#8230; does not exist in the current context&#8221; in ASP.NET</title>
		<link>http://www.compdigitec.com/labs/2010/07/07/solving-the-name-does-not-exist-in-the-current-context-in-asp-net/</link>
		<comments>http://www.compdigitec.com/labs/2010/07/07/solving-the-name-does-not-exist-in-the-current-context-in-asp-net/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 15:16:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTTP (Internet)]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[aspnet]]></category>
		<category><![CDATA[aspx]]></category>
		<category><![CDATA[backup files]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[cs]]></category>
		<category><![CDATA[duplicate]]></category>
		<category><![CDATA[visual basic]]></category>
		<category><![CDATA[visual studio]]></category>
		<category><![CDATA[visual web designer]]></category>

		<guid isPermaLink="false">http://www.compdigitec.com/labs/?p=171</guid>
		<description><![CDATA[A little-known fact is that in ASP.NET is that you cannot have two copies of the same ASP.NET web page in the same folder, or it will attempt to load elements (such as controls) from the (usually) wrong page, and end up confusing itself, resulting in the error &#8220;The name &#8230; does not exist in [...]]]></description>
			<content:encoded><![CDATA[<p>A little-known fact is that in ASP.NET is that you cannot have two copies of the same ASP.NET web page in the same folder, or it will attempt to load elements (such as controls) from the (usually) wrong page, and end up confusing itself, resulting in the error &#8220;The name &#8230; does not exist in the current context&#8221;. This can be very confusing as you try to figure out why it is not working even though it looks like you are doing it correctly.</p>
<p>To resolve this,<strong> make sure there are no copies of the page in the same folder</strong> (such as things like backup files, accidental copies, etc) in the same folder. Either move them to a different folder or rename their extensions: .aspx to .aspxold and .cs to .csold.</p>]]></content:encoded>
			<wfw:commentRss>http://www.compdigitec.com/labs/2010/07/07/solving-the-name-does-not-exist-in-the-current-context-in-asp-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

