<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8963822716151911358</id><updated>2012-02-16T11:07:51.210Z</updated><category term='Powershell'/><category term='Sharepoint'/><category term='GridView'/><category term='SQL Server'/><title type='text'>2000MPH Programmer Blog</title><subtitle type='html'>A blog to store guides and notes and help on coding. Mostly .Net C# SQL ASP.Net and other related technologies. I post on here things that helped me solve coding issues that I hope will be of help to others.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>19</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-644490445355407376</id><published>2011-02-10T15:58:00.004Z</published><updated>2011-05-23T15:47:08.624+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>SQL Server - Template Script for Looping Throught Table Without Using Cursor</title><content type='html'>Below is a single SQL Script I put together to use as a template whenever I need to loop through an SQL Table to then perform operations per row on certain data I can do it using this script. &lt;br /&gt;&lt;br /&gt;The template is simple to understand it basically uses a temp table to copy into it the data you are interested in and then loop through it. The template then shows how to use the value you get from each row by just printing it to the screen. Of course you can replace that with any other code you want to.&lt;br /&gt;&lt;br /&gt;&lt;pre class="brush: sql"&gt;&lt;br /&gt;-- Created 08/04/2010 by Matt Harrison&lt;br /&gt;-- Template for Looping through table rows without using a cursor&lt;br /&gt;------------------------------------------------------------------&lt;br /&gt;&lt;br /&gt;DECLARE @RowCnt int&lt;br /&gt;DECLARE @MaxRows int&lt;br /&gt;SET @RowCnt = 1&lt;br /&gt;&lt;br /&gt;DECLARE @TempTableName Table (rownum int IDENTITY (1, 1) PRIMARY KEY NOT NULL , Value_Name1 nvarchar(10))&lt;br /&gt;&lt;br /&gt;-- Populate the TempTable&lt;br /&gt;INSERT INTO @TempTableName (Value_Name1) (SELECT Value_Name1 FROM DatabaseTableName)&lt;br /&gt;SET @MaxRows = (SELECT count(*) FROM @TempTableName)&lt;br /&gt;&lt;br /&gt;-- Foreach Row in TempTableName&lt;br /&gt;WHILE @RowCnt &lt;= @MaxRows&lt;br /&gt;BEGIN&lt;br /&gt;&lt;br /&gt; DECLARE @Value_Name nvarchar(10)&lt;br /&gt; SET @Value_Name = (SELECT Value_Name1 FROM @TempTableName WHERE rownum = @RowCnt)&lt;br /&gt; &lt;br /&gt; PRINT 'Row Value_Name ' + @Value_Name&lt;br /&gt; &lt;br /&gt; -- Next Row&lt;br /&gt; SET @RowCnt = @RowCnt + 1&lt;br /&gt;END&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-644490445355407376?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/644490445355407376/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=644490445355407376' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/644490445355407376'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/644490445355407376'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2011/02/sql-server-template-script-for-looping.html' title='SQL Server - Template Script for Looping Throught Table Without Using Cursor'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-6558295321039504629</id><published>2011-02-09T12:17:00.005Z</published><updated>2011-02-09T12:25:10.475Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>Reset Service Broker Quene in SQL Server</title><content type='html'>I find from time to time when using a Service Broker Queue in SQL Server it just stops and messages just sit in the queue. I have found that the script below forces something to get reset that springs the queue back into life. It's ages since I found this script so can't even remember why it works, but it usually does. &lt;br /&gt;&lt;br /&gt;ALTER MASTER KEY FORCE REGENERATE WITH ENCRYPTION BY PASSWORD = 'Password'; &lt;br /&gt;&lt;br /&gt;Where "Password" can be set to any suitable password.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-6558295321039504629?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/6558295321039504629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=6558295321039504629' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/6558295321039504629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/6558295321039504629'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2011/02/reset-service-broker-quene-in-sql.html' title='Reset Service Broker Quene in SQL Server'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-273098953045425139</id><published>2009-12-08T13:33:00.004Z</published><updated>2011-02-09T12:27:26.394Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>Reseed an SQL Table Identity Column</title><content type='html'>If you get an unexpected error like this...&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Violation of PRIMARY KEY constraint 'PK_Name'. Cannot insert duplicate key in object 'Table_Name'.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You look at your table and the primary key and realise that the primary key that was complianing was a indentity column then you think well isn't that a bit odd. The point of an identity column is that you insert new rows in a database and it generates a primarykey value for you, usually a unqiue integer value.&lt;br /&gt;&lt;br /&gt;Sometimes though for some mystic unknown reason (one that I can't be bothered to find out the real cause for) the identity value that is created is invalid. So whats the solution?&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;DBCC CHECKIDENT&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You can use this SQL command to check what the current status of an identity column on a table is. If you run the below command, it will tell you the current identify value, i.e. the next value that would be generated as a unquire identity value, and it will tell you the current column value, ie. the current highest unqiue identity value used in your database.&lt;br /&gt;&lt;pre name="code" class="sql"&gt;DBCC CHECKIDENT ("Table Name", NORESEED);&lt;/pre&gt;&lt;br /&gt;Now if it returns something like this then you may have a problem.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Checking identity information: current identity value '10', current column value '17'.&lt;br /&gt;DBCC execution completed. If DBCC printed error messages, contact your system administrator.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If the current column value is higher than the current identity value then the problem may be that you are trying to insert a new row and the identity value being inserted automatically is '10' when the rows have already been created for identity values up to '17'.&lt;br /&gt;&lt;br /&gt;To fix this just run this command to reset the identity value.&lt;br /&gt;&lt;pre name="code" class="sql"&gt;DBCC CHECKIDENT ("Table Name", RESEED);&lt;/pre&gt;&lt;br /&gt;Then run the previous command again and you should see this result.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Checking identity information: current identity value '17', current column value '17'.&lt;br /&gt;DBCC execution completed. If DBCC printed error messages, contact your system administrator.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Sorted.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-273098953045425139?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/273098953045425139/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=273098953045425139' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/273098953045425139'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/273098953045425139'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2009/12/reseed-sql-table-identity-column.html' title='Reseed an SQL Table Identity Column'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-7072521551766607520</id><published>2009-05-19T09:38:00.002+01:00</published><updated>2009-05-19T09:41:19.981+01:00</updated><title type='text'>Make ‘Folders View’ the Windows Explorer Default in Windows XP</title><content type='html'>Here is a link to a very handy blog post on how to make folders view in the explorer bar, in windows explorer default to folders view, instead of that silly blue common tasks bar. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.daleisphere.com/make-folders-view-the-windows-explorer-default-in-windows-xp/"&gt;http://www.daleisphere.com/make-folders-view-the-windows-explorer-default-in-windows-xp/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Great!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-7072521551766607520?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/7072521551766607520/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=7072521551766607520' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/7072521551766607520'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/7072521551766607520'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2009/05/make-folders-view-windows-explorer.html' title='Make ‘Folders View’ the Windows Explorer Default in Windows XP'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-2000130389282317051</id><published>2009-05-07T09:47:00.002+01:00</published><updated>2009-05-07T09:53:01.971+01:00</updated><title type='text'>How to create your own Code Signing Certificates</title><content type='html'>This has been a real pain for me recently. At work we had previously got code signing certificates from a certificate authority called Thawte. But when it came time to renew, they have been totally unhelpful, slow and inept. We have spent a month dealing with them trying to get a renewed certificated with no joy, so they can now go shove a banana because we are going to sort out our own certificates. &lt;br /&gt;&lt;br /&gt;There is a great step by step guide in this forum discussion on channel9 that will help you set up your own code signing certificate.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://channel9.msdn.com/forums/TechOff/13583-Generating-my-own-Software-Publishing-Certificate/"&gt;http://channel9.msdn.com/forums/TechOff/13583-Generating-my-own-Software-Publishing-Certificate/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;It's a fiddly process but worth it if all you need is a certificate to sign your code for use within your own network.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-2000130389282317051?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/2000130389282317051/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=2000130389282317051' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/2000130389282317051'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/2000130389282317051'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2009/05/how-to-create-your-own-code-signing.html' title='How to create your own Code Signing Certificates'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-3467458012066580489</id><published>2009-04-29T12:08:00.003+01:00</published><updated>2009-04-29T12:13:54.090+01:00</updated><title type='text'>Using SyntaxHighlighter to display code snippets</title><content type='html'>Today I found a very handy javascript to display code snippets in web pages, and it can be adapted to work in Blogs as well. &lt;br /&gt;&lt;br /&gt;The &lt;a href="http://alexgorbatchev.com/wiki/SyntaxHighlighter"&gt;SyntaxHighlighter&lt;/a&gt; is very clever, and can display a lot of different code types, for example C#.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="csharp"&gt;&lt;br /&gt;//Here is some C# Code&lt;br /&gt;public void Method()&lt;br /&gt;{&lt;br /&gt;   string test = "display some code in my blog";&lt;br /&gt;   test = test.tostring() + "and format it nicely";&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;There is a nice blog post by Arun K Viswanathan on how to easily adapt the code to work in Blogger. &lt;a href="http://tech.element77.com/2008/11/syntax-highlighting-code-in-blog-posts.html"&gt;Check it out.&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-3467458012066580489?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/3467458012066580489/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=3467458012066580489' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/3467458012066580489'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/3467458012066580489'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2009/04/using-syntaxhighlighter-to-display-code.html' title='Using SyntaxHighlighter to display code snippets'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-2987208913902037184</id><published>2009-01-22T14:40:00.006Z</published><updated>2011-02-09T12:27:43.318Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>Drop Constraint in MS SQL that has an unknown name</title><content type='html'>Now when I say unknown name I catually mean I know constraint I want to drop, however the name of the constraint was automatically generated by SQL Server and that name contains a random number e.g.&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;"DF__user__15502E78"&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Well I could just write a script like this to get rid of it:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="sql"&gt;&lt;br /&gt;alter table [user]&lt;br /&gt;drop constraint [DF__user__15502E78]&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Fine that works, but what if I have created multiple version of that DB on different servers, each time SQL Server creates that constraint for me automatically it will contain a different random number in the name. So now when I run the script I worte above on a different server it fails.&lt;br /&gt;&lt;br /&gt;So I wrote this little script below, that will search out the constraint and drop it for me. Now you will have to tweak this to get it to work for you as you may have more constraints as I ad in my DB, so you will need to alter the WHERE clause a bit to just get back the constraint name you are looking for.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="sql"&gt;&lt;br /&gt;-- Because this constraint is dyncamically created by SQL Server&lt;br /&gt;-- the name of the constraint contains a random number&lt;br /&gt;-- so the name will be different from DB to DB.&lt;br /&gt;-- So the only way to drop the constraint is to use the script below.&lt;br /&gt;DECLARE @constraint varchar(100)&lt;br /&gt;SET @constraint = (SELECT OBJECT_NAME(OBJECT_ID) --AS NameofConstraint,&lt;br /&gt;            --SCHEMA_NAME(schema_id) AS SchemaName,&lt;br /&gt;            --OBJECT_NAME(parent_object_id) AS TableName,&lt;br /&gt;            --type_desc AS ConstraintType&lt;br /&gt;    FROM sys.objects&lt;br /&gt;    WHERE type_desc LIKE '%CONSTRAINT'&lt;br /&gt;    AND OBJECT_NAME(parent_object_id) = 'user'&lt;br /&gt;    AND type_desc &lt;&gt; 'PRIMARY_KEY_CONSTRAINT')&lt;br /&gt;&lt;br /&gt;print @constraint&lt;br /&gt;&lt;br /&gt;declare @sqlscript varchar(200)&lt;br /&gt;&lt;br /&gt;set @sqlscript = 'alter table [user] drop constraint ' + @constraint&lt;br /&gt;&lt;br /&gt;print @sqlscript&lt;br /&gt;&lt;br /&gt;exec(@sqlscript)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If you look at the select clause in the script above that is what i'm using to return the name of the constraint, you can uncomment the values in that select statement and just run and tweak that to get it just right for you and then insert it back into the rest of the script and your all sorted.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-2987208913902037184?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/2987208913902037184/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=2987208913902037184' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/2987208913902037184'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/2987208913902037184'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2009/01/drop-constraint-in-ms-sql-that-has.html' title='Drop Constraint in MS SQL that has an unknown name'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-6214454840101405091</id><published>2008-12-08T16:07:00.001Z</published><updated>2008-12-08T16:07:46.287Z</updated><title type='text'>Script Debugging in IE</title><content type='html'>Refer to this nice Blog post here: &lt;a href="http://blogs.msdn.com/ie/archive/2004/10/26/247912.aspx"&gt;http://blogs.msdn.com/ie/archive/2004/10/26/247912.aspx&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-6214454840101405091?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/6214454840101405091/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=6214454840101405091' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/6214454840101405091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/6214454840101405091'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2008/12/script-debugging-in-ie.html' title='Script Debugging in IE'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-7457899741406069796</id><published>2008-11-28T10:53:00.001Z</published><updated>2008-11-28T10:54:39.898Z</updated><title type='text'>How to display HTML code in your Blogger Post</title><content type='html'>Convert the code to display in a blog post using this tool:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.accessify.com/tools-and-wizards/developer-tools/quick-escape/default.php"&gt;http://www.accessify.com/tools-and-wizards/developer-tools/quick-escape/default.php&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-7457899741406069796?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/7457899741406069796/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=7457899741406069796' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/7457899741406069796'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/7457899741406069796'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2008/11/how-to-display-html-code-in-your.html' title='How to display HTML code in your Blogger Post'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-5087146391205444170</id><published>2008-11-28T10:03:00.008Z</published><updated>2009-04-29T12:06:21.574+01:00</updated><title type='text'>Sorting and Paging a GridView with Custom DataSource in ASP.Net</title><content type='html'>So it's pretty simple to use a GridView in ASP.Net you can bind it to all sorts of data, but what I like doing is binding it to collections of my own custom objects. But this causes issues, because then you can't use all the nice in built paging and sorting without extra cosing. If you use the GridView wizard are hook it up to a SQLdatasource directly or a data set then all the paging and sorting is handled for you. But what if like me you want to use your own custome objects.&lt;br /&gt;&lt;br /&gt;Well there is a way, it does require a little extras coding but it's nothing too complicated. Firstly lets look at the code to set up a standard GridView:&lt;br /&gt;&lt;br /&gt;Client Side Code:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;asp:gridview id="GridView1" runat="server" autogeneratecolumns="False" onrowdatabound="GridView1_RowDataBound" onselectedindexchanging="GridView1_SelectedIndexChanging"&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;columns&amp;gt;&lt;br /&gt;&lt;br /&gt;       &amp;lt;asp:boundfield datafield="ProjectID" headertext="ProjectID"/&amp;gt;&lt;br /&gt;&lt;br /&gt;       &amp;lt;asp:boundfield datafield="ProjectName" headertext="ProjectName"/&amp;gt;&lt;br /&gt;&lt;br /&gt;       &amp;lt;asp:boundfield datafield="Sector" headertext="Sector"/&amp;gt;&lt;br /&gt;&lt;br /&gt;       &amp;lt;asp:boundfield datafield="ProjectStatus" headertext="Project Status"/&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;/columns&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/asp:gridview&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Server Side Code:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="csharp"&gt;&lt;br /&gt;IList&amp;lt;project&amp;gt; projectList = Project.GetAllProjects();&lt;br /&gt;GridView1. DataSource = projectList;&lt;br /&gt;GridView1.DataBind();&lt;br /&gt;&lt;br /&gt;Project Class:&lt;br /&gt;&lt;br /&gt;public class Project&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;public Project()&lt;br /&gt;{&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public int ProjectID { get;set;}&lt;br /&gt;&lt;br /&gt;public string ProjectName {get;set;}&lt;br /&gt;&lt;br /&gt;public string Sector {get;set;}&lt;br /&gt;&lt;br /&gt;public string ProjectStatus {get;set;}&lt;br /&gt;&lt;br /&gt;static public Project GetAllProjects()&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;So this will display my list of custom objects in a simple GridView but I can't do paging or sorting, bummer. So what do we have to change to get it to work?&lt;br /&gt;&lt;br /&gt;Well first on the ASP.Net page we add an ObjectDataSource control and point that to our datasource. This will help make our custome data collection more compatible with the GridView. We can then point out GridView at this ObjectDataSource.&lt;br /&gt;&lt;br /&gt;We can then set paging on the GridView and Sorting. But for the sorting to work we still need some extra code. We need to make our custom data class comparable. So in the GetAllProjects method we add a parameter that will handle the sortExpression, we add this into the code of our GridView as well.&lt;br /&gt;&lt;br /&gt;Then we add a switch statement in here to handle this sort expression. This requires us also to create a comparer class, we will call it ProjectComparer and in there we place code to handle the comparisons for each project value.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Client Side Code:  &lt;br /&gt;&lt;pre name="code" class="xml"&gt;&lt;br /&gt;&amp;lt;asp:ObjectDataSource ID="dsProjects" runat="server" DataObjectTypeName="Business.DomainLogic.Project" TypeName="Business.DomainLogic.Project" SelectMethod="GetAllProjects" SortParameterName="sortExpression"&amp;gt;&amp;lt;/asp:ObjectDataSource&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"&lt;br /&gt;       OnRowDataBound="GridView1_RowDataBound" DataSourceID="dsProjects"&lt;br /&gt;       AllowPaging="True" PageSize="8" AllowSorting="True"&lt;br /&gt;       OnSelectedIndexChanging="GridView1_SelectedIndexChanging"&lt;br /&gt;       OnPageIndexChanging="GridView1_PageIndexChanging"&amp;gt;&lt;br /&gt;       &amp;lt;Columns&amp;gt;&lt;br /&gt;           &amp;lt;asp:BoundField DataField="ProjectID" HeaderText="ProjectID"  /&amp;gt;&lt;br /&gt;           &amp;lt;asp:BoundField DataField="ProjectName" HeaderText="ProjectName" SortExpression="ProjectName" /&amp;gt;&lt;br /&gt;           &amp;lt;asp:BoundField DataField="Sector" HeaderText="Sector" SortExpression="Sector" /&amp;gt;&lt;br /&gt;           &amp;lt;asp:BoundField DataField="ProjectStatus" HeaderText="Project Status" SortExpression="ProjectStatus" /&amp;gt;&lt;br /&gt;       &amp;lt;/Columns&amp;gt;&lt;br /&gt;   &amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Server Side Code:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="csharp"&gt;&lt;br /&gt;protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)&lt;br /&gt;       {&lt;br /&gt;           GridView1.PageIndex = e.NewPageIndex;&lt;br /&gt;           GridView1.DataBind();&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;Project Class:&lt;br /&gt;&lt;br /&gt;public List&amp;lt;project&amp;gt; GetAllProjects(string sortExpression)&lt;br /&gt;{&lt;br /&gt;      List&amp;lt;project&amp;gt; projects = new List&amp;lt;project&amp;gt;();&lt;br /&gt;&lt;br /&gt;      switch (sortExpression)&lt;br /&gt;           {&lt;br /&gt;               case "ProjectName":&lt;br /&gt;               case "ProjectName ASC":&lt;br /&gt;                   projects.Sort(ProjectComparer.CompareByName);&lt;br /&gt;                   break;&lt;br /&gt;&lt;br /&gt;               case "ProjectName DESC":&lt;br /&gt;                   projects.Sort(ProjectComparer.CompareByNameDesc);&lt;br /&gt;                   break;&lt;br /&gt;&lt;br /&gt;               case "Sector":&lt;br /&gt;               case "Sector ASC":&lt;br /&gt;                   projects.Sort(ProjectComparer.CompareBySector);&lt;br /&gt;                   break;&lt;br /&gt;&lt;br /&gt;               case "Sector DESC":&lt;br /&gt;                   projects.Sort(ProjectComparer.CompareBySectorDesc);&lt;br /&gt;                   break;&lt;br /&gt;&lt;br /&gt;               case "ProjectStatus":&lt;br /&gt;               case "ProjectStatus ASC":&lt;br /&gt;                   projects.Sort(ProjectComparer.CompareByProjectStatus);&lt;br /&gt;                   break;&lt;br /&gt;&lt;br /&gt;               case "ProjectStatus DESC":&lt;br /&gt;                   projects.Sort(ProjectComparer.CompareByProjectStatusDesc);&lt;br /&gt;                   break;&lt;br /&gt;           }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;ProjectComparer Class:&lt;br /&gt;&lt;br /&gt;public class ProjectComparer&lt;br /&gt;   {&lt;br /&gt;       //COMPARE BY NAME&lt;br /&gt;&lt;br /&gt;       private static IComparer&amp;lt;project&amp;gt; _compareByName = new _sortName(false);&lt;br /&gt;       public static IComparer&amp;lt;project&amp;gt; CompareByName { get { return _compareByName; } }&lt;br /&gt;&lt;br /&gt;       private static IComparer&amp;lt;project&amp;gt; _compareByNameDesc = new _sortName(true);&lt;br /&gt;       public static IComparer&amp;lt;project&amp;gt; CompareByNameDesc { get { return _compareByNameDesc; } }&lt;br /&gt;&lt;br /&gt;       private class _sortName : IComparer&amp;lt;project&amp;gt;&lt;br /&gt;       {&lt;br /&gt;           bool _reverse;&lt;br /&gt;           public _sortName(bool reverse)&lt;br /&gt;           {&lt;br /&gt;               this._reverse = reverse;&lt;br /&gt;           }&lt;br /&gt;&lt;br /&gt;           public int Compare(Project x, Project y)&lt;br /&gt;           {&lt;br /&gt;               if (_reverse) return y.ProjectName.CompareTo(x.ProjectName);&lt;br /&gt;               else return x.ProjectName.CompareTo(y.ProjectName);&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//COMPARE BY SECTOR&lt;br /&gt;&lt;br /&gt;       private static IComparer&amp;lt;project&amp;gt; _compareBySector = new _sortSector(false);&lt;br /&gt;       public static IComparer&amp;lt;project&amp;gt; CompareBySector { get { return _compareBySector; } }&lt;br /&gt;&lt;br /&gt;       private static IComparer&amp;lt;project&amp;gt; _compareBySectorDesc = new _sortSector(true);&lt;br /&gt;       public static IComparer&amp;lt;project&amp;gt; CompareBySectorDesc { get { return _compareBySectorDesc; } }&lt;br /&gt;&lt;br /&gt;       private class _sortSector : IComparer&amp;lt;project&amp;gt;&lt;br /&gt;       {&lt;br /&gt;           bool _reverse;&lt;br /&gt;           public _sortSector(bool reverse)&lt;br /&gt;           {&lt;br /&gt;               this._reverse = reverse;&lt;br /&gt;           }&lt;br /&gt;&lt;br /&gt;           public int Compare(Project x, Project y)&lt;br /&gt;           {&lt;br /&gt;               if (_reverse) return y.Sector.CompareTo(x.Sector);&lt;br /&gt;               else return x.Sector.CompareTo(y.Sector);&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//COMPARE BY Project Status&lt;br /&gt;&lt;br /&gt;       private static IComparer&amp;lt;project&amp;gt; _compareByProjectStatus = new _sortProjectStatus(false);&lt;br /&gt;       public static IComparer&amp;lt;project&amp;gt; CompareByProjectStatus { get { return _compareByProjectStatus; } }&lt;br /&gt;&lt;br /&gt;       private static IComparer&amp;lt;project&amp;gt; _compareByProjectStatusDesc = new _sortProjectStatus(true);&lt;br /&gt;       public static IComparer&amp;lt;project&amp;gt; CompareByProjectStatusDesc { get { return _compareByProjectStatusDesc; } }&lt;br /&gt;&lt;br /&gt;       private class _sortProjectStatus : IComparer&amp;lt;project&amp;gt;&lt;br /&gt;       {&lt;br /&gt;           bool _reverse;&lt;br /&gt;           public _sortProjectStatus(bool reverse)&lt;br /&gt;           {&lt;br /&gt;               this._reverse = reverse;&lt;br /&gt;           }&lt;br /&gt;&lt;br /&gt;           public int Compare(Project x, Project y)&lt;br /&gt;           {&lt;br /&gt;               if (_reverse) return y.ProjectStatus.CompareTo(x.ProjectStatus);&lt;br /&gt;               else return x.ProjectStatus.CompareTo(y.ProjectStatus);&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;And that will give you paging and sorting on your GridView bound to a collection of custom objects. If i have missed any thing or it doesn't make any sense, plese just drop me a comment.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-5087146391205444170?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/5087146391205444170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=5087146391205444170' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/5087146391205444170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/5087146391205444170'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2008/11/sorting-and-paging-gridview-with-custom.html' title='Sorting and Paging a GridView with Custom DataSource in ASP.Net'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-4395002564232245998</id><published>2008-11-11T16:37:00.007Z</published><updated>2011-02-09T12:27:55.748Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server'/><title type='text'>SQL Server Collation</title><content type='html'>This error sucks the first time you see it because you may have no idea what it means:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Cannot resolve the collation conflict between "SQL_Latin1_General_CP1_CI_AS" and "Latin1_General_CI_AS" in the equal to operation&lt;/blockquote&gt;&lt;br /&gt;&lt;br /&gt;Well you can do a search to find the solution but basically if your doing a join between two tables from two seperate databases then this might happen. One has the wrong collation. You can Check like this:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="sql"&gt;&lt;br /&gt;use DB1&lt;br /&gt;print 'My database [' + db_name() + '] collation is: ' + cast( DATABASEPROPERTYEX ( db_name(), N'Collation' ) as varchar(128) )&lt;br /&gt;&lt;br /&gt;use DB2&lt;br /&gt;print 'My database [' + db_name() + '] collation is: ' + cast( DATABASEPROPERTYEX ( db_name(), N'Collation' ) as varchar(128) )&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;If they are different then on your join just add this to the end of the code to convert the collation.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="sql"&gt;JOIN&lt;br /&gt;Table T ON T.ID = P.ID COLLATE Latin1_General_CI_AS&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-4395002564232245998?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/4395002564232245998/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=4395002564232245998' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/4395002564232245998'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/4395002564232245998'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2008/11/sql-server-collation.html' title='SQL Server Collation'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-1428908950072474150</id><published>2008-05-15T10:26:00.005+01:00</published><updated>2009-04-29T12:07:49.745+01:00</updated><title type='text'>Programmatically Creating GridView with Template Columns ASP.Net C#.Net</title><content type='html'>So making a grid view is easy, the designer in Visual Studio is really easy to use to set up columns and bind to a data source. However that's only useful if you know what columns you want and if you know exactly where and when you want to display this data.&lt;br /&gt;&lt;br /&gt;What if some of these details are built up dynamically through code while your site is running. I had a situation where I wanted to build up multiple grid views pro grammatically as a result of a user interaction, and I didn't just want normal columns of text data, my grid view required template columns. So how do you create grid view template columns through your server side code?&lt;br /&gt;&lt;br /&gt; &lt;pre name="code" class="CSharp"&gt;&lt;br /&gt; // C#.Net code to Create Grid View //&lt;br /&gt; GridView newGrid = new GridView();&lt;br /&gt;&lt;br /&gt; TemplateField template = new TemplateField();&lt;br /&gt; template.ItemTemplate = new GridViewTemplate(ListItemType.Item, columnName);&lt;br /&gt;&lt;br /&gt; newGrid.Columns.Add(template);&lt;br /&gt;&lt;br /&gt; newGrid.DataSource = 'Your Data Source Object';&lt;br /&gt; newGrid.DataBind();&lt;br /&gt; &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The above code will create a Grid View control, this can already exist on your page if you want or as I have done you can create it in code. It maybe best to call this code from the Page_Load method, but you can experiment with that.&lt;br /&gt;&lt;br /&gt;Then we will create a Template column and add it to the Grid View, you can create as many of these as you require columns. The code will then bind a Data Source to your Grid View, how the values of that Data Source are displayed is handled in the code below.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Below is the Class code for a GridViewTemplate.&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="CSharp"&gt;&lt;br /&gt;&lt;br /&gt;public class GridViewTemplate : System.Web.UI.Page, ITemplate&lt;br /&gt;{&lt;br /&gt;   ListItemType _templateType;&lt;br /&gt;   string _columnName;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   public GridViewTemplate(ListItemType type, string columnName)&lt;br /&gt;   {&lt;br /&gt;       _templateType = type;&lt;br /&gt;       _groupName = columnName;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   public void InstantiateIn(System.Web.UI.Control container)&lt;br /&gt;   {&lt;br /&gt;&lt;br /&gt;       switch (_templateType)&lt;br /&gt;       {&lt;br /&gt;&lt;br /&gt;           case ListItemType.Header:&lt;br /&gt;&lt;br /&gt;               break;&lt;br /&gt;&lt;br /&gt;           case ListItemType.Item:&lt;br /&gt;&lt;br /&gt;               Literal lc = new Literal();&lt;br /&gt;&lt;br /&gt;               lc.DataBinding += new EventHandler(this.lc_DataBinding);&lt;br /&gt;&lt;br /&gt;               container.Controls.Add(lc);&lt;br /&gt;&lt;br /&gt;               break;&lt;br /&gt;&lt;br /&gt;           case ListItemType.EditItem:&lt;br /&gt;&lt;br /&gt;               break;&lt;br /&gt;&lt;br /&gt;           case ListItemType.Footer:&lt;br /&gt;&lt;br /&gt;               break;&lt;br /&gt;&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   private void lc_DataBinding(Object sender, EventArgs e)&lt;br /&gt;   {&lt;br /&gt;      &lt;br /&gt;       Literal lc = (Literal)sender;&lt;br /&gt;      &lt;br /&gt;       GridViewRow row = (GridViewRow)lc.NamingContainer;&lt;br /&gt;      &lt;br /&gt;       string propertyValue =&lt;br /&gt;              DataBinder.Eval(row.DataItem, "PropertyName").ToString();&lt;br /&gt;   &lt;br /&gt;       lc.Text = propertyValue;&lt;br /&gt;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The GridViewTemplate will set up the basics of your template column. You can set the Header, Item, Footer etc..  and add controls to them just as you could add controls through the designer.&lt;br /&gt;&lt;br /&gt;You can then set up Data Binding to these controls, in the Data Binding method you will then pass in the name of the property from your Data Source you want to display the value for in that control, eg. "PropertyName".&lt;br /&gt;&lt;br /&gt;Hope this is a useful basic reference for this, hopefully from this you can easily figure out even more complex things you can do with the Grid View.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-1428908950072474150?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/1428908950072474150/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=1428908950072474150' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/1428908950072474150'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/1428908950072474150'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2008/05/programmatically-creating-gridview-with.html' title='Programmatically Creating GridView with Template Columns ASP.Net C#.Net'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-8628470522308773042</id><published>2008-04-30T16:42:00.003+01:00</published><updated>2008-04-30T16:46:59.877+01:00</updated><title type='text'>A nice ticking clock for your asp.net webpage</title><content type='html'>I looked around for ages to get a ticking clock on my webpage and couldn't find one that would work in both IE and Firefox. Lots of javascripts sites and lots of not great scripts for a ticking clock. &lt;br /&gt;&lt;br /&gt;However I found this site and implemented this solution really quickly and easily. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.dynamicdrive.com/dynamicindex6/localtime.htm"&gt;Dynamic Drive Ticking Clock&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Great, have fun.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-8628470522308773042?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/8628470522308773042/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=8628470522308773042' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/8628470522308773042'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/8628470522308773042'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2008/04/nice-ticking-clock-for-your-aspnet.html' title='A nice ticking clock for your asp.net webpage'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-8475848623360617804</id><published>2008-04-30T11:34:00.002+01:00</published><updated>2008-04-30T11:41:58.318+01:00</updated><title type='text'>IE6, CSS Debugging Issues</title><content type='html'>Since today was spent debugging a css issue in IE6 I would like to post some solutions and development tools that are useful for this sort of thing. &lt;br /&gt;&lt;br /&gt;Firstly the main issue that I seems to have was that images inside a table cell left a white space gap of about 3 pixels between bottom of the image and the bottom of the table cell. &lt;br /&gt;&lt;br /&gt;The problem was that the vertical-align of the image in IE6 was defaulting to baseline, which apparently means its aligned vertically to the baseline of the text, meaning 3 pixel gap is left to accomodate the trailing tails og letters such as lower case g and y. &lt;br /&gt;&lt;br /&gt;To fix this you must vertical-align the image using vertical-align: bottom;&lt;br /&gt;&lt;br /&gt;While trying to debug this issue I found two very useful tools. In Firefox you can download the addon, FireBug, that will let you debug a webpage. There are also tools identical to this for IE6 and IE7 which are more handy because in my experience its IE that has more trouble rendering a web page correctly. &lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.windowsmarketplace.com/details.aspx?view=info&amp;itemid=2695980"&gt;IE Developer ToolBar&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.debugbar.com/?langage=en"&gt;IE DebugBar&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-8475848623360617804?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/8475848623360617804/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=8475848623360617804' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/8475848623360617804'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/8475848623360617804'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2008/04/ie6-css-debugging-issues.html' title='IE6, CSS Debugging Issues'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-3866991898739460945</id><published>2008-03-03T16:18:00.004Z</published><updated>2009-04-29T11:55:44.298+01:00</updated><title type='text'>using .Net ToString() to format currency values</title><content type='html'>A nice little bit of code to help display decimal values as currency and using the ever so helpful ToString() method. All you do is add in some format info as show below to tell it to format the string as a currency. &lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="csharp"&gt;&lt;br /&gt;decimal myMoney = 142.00;&lt;br /&gt;string formattedString = myMoney.ToString("c0");&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;It will use the CurrentInfo property of System.Globalization.NumberFormatInfo the localization information to work out what currency to use. So for me the formatted string would be £142. The zero in the format string sets the number of decimal places to use. &lt;br /&gt;&lt;br /&gt;To convert this value back to a decimal you can use this code below. &lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="csharp"&gt;&lt;br /&gt;decimal myMoney = Decimal.Parse(formattedString , NumberStyles.Currency);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Just to be safe wrap this in a try catch block to catch System.FormatException errors  which means that someone entered a value using the wrong currency type. SO if the CurrentInfo says the local currency should be US dollars $142 and someone uses pounds  £142 instead it will complain.&lt;br /&gt;&lt;br /&gt;Right cool, think that's just about that. &lt;br /&gt;&lt;br /&gt;MPH.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-3866991898739460945?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/3866991898739460945/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=3866991898739460945' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/3866991898739460945'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/3866991898739460945'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2008/03/using-net-tostring-to-format-currency.html' title='using .Net ToString() to format currency values'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-3146952510688146800</id><published>2008-02-29T16:40:00.007Z</published><updated>2009-04-29T11:53:27.293+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GridView'/><title type='text'>GridView Select Rows Code 2.0</title><content type='html'>Simple link to a good post about how to make a Grid View row selectable without having a button at the end of each row, you can just click on the row to fire the onSelectedIndexChanging Event.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.geekzilla.co.uk/View9FC28EE6-ACB0-4F51-BFE4-38B0B10134D5.htm"&gt;http://www.geekzilla.co.uk/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Linked Post written by : &lt;strong&gt;Paul Marshall&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: normal;"&gt;Here is a minor imporvement I made to the code written by Paul Marshall that just makes it easier to control the styling applied onMouseOver of the grid. I used it to change it so the whol row is highlighted rather than just underlining the text.&lt;br /&gt;&lt;br /&gt;In GridView_RowDataBound I changed this bit of code to reference the my css file.&lt;br /&gt;&lt;pre name="code" class="csharp"&gt;&lt;br /&gt;e.Row.Attributes["onmouseover"] ="this.style.cursor='hand';this.className='gridRollOver';";&lt;br /&gt;e.Row.Attributes["onmouseout"] = "this.className='';";&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-3146952510688146800?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/3146952510688146800/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=3146952510688146800' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/3146952510688146800'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/3146952510688146800'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2008/02/gridview-select-rows-code-20.html' title='GridView Select Rows Code 2.0'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-2337649682423622312</id><published>2008-02-29T11:33:00.002Z</published><updated>2008-02-29T11:38:50.709Z</updated><title type='text'>A Belated Welcome to My New Blog</title><content type='html'>I created this new blog the other day when I realised I was starting to add lots of boring geeky programming stuff to my personal blog. The main problem with that is that my Wordpress blog isn't very customizable, the code quotes are crap and for some reason at the moment the edit tools are a bit broken.&lt;br /&gt;&lt;br /&gt;So I decided to create a new blog just for all the boring coding tips and helpful hints I want to write about, mostly just as a place for me to collate stuff so I don't have to remember it in my head.&lt;br /&gt;&lt;br /&gt;I was going to try a few different blog sites but Blogger appears to be really good and I quite like how customizable it is with so many templates and being able to edit the HTML directly for the template and CSS is much nicer than Wordpress so I'm just going to use this.&lt;br /&gt;&lt;br /&gt;A link to my regular blog is in the side bar so I will still keep that going to write blog posts about general more interesting stuff than computer programming and save this bog just for the boring stuff.&lt;br /&gt;&lt;br /&gt;MPH.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-2337649682423622312?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/2337649682423622312/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=2337649682423622312' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/2337649682423622312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/2337649682423622312'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2008/02/belated-welcome-to-my-new-blog.html' title='A Belated Welcome to My New Blog'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-1077371105142339020</id><published>2008-02-27T18:07:00.001Z</published><updated>2009-04-29T11:51:49.811+01:00</updated><title type='text'>Find Good Free Blog Templates</title><content type='html'>I just created this blog today and have been playing around with the formatting of it. I want to get a clear, easy to read and well organized template. Below is a link to the best template site you will find with hundreds of Free Templates for many different blogs.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://www.eblogtemplates.com/"&gt;http://www.eblogtemplates.com/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Also some nice CSS code to add a shaded boxes around areas for code or quotes:&lt;br /&gt;&lt;br /&gt;&lt;pre name="code" class="css"&gt;&lt;br /&gt;blockquote&lt;br /&gt;{ &lt;br /&gt;margin:.75em 0; &lt;br /&gt;border:1px solid #596; &lt;br /&gt;border-width:1px 1px; &lt;br /&gt;padding:5px 15px; &lt;br /&gt;display: block; &lt;br /&gt;background-color: #dedede; &lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;code &lt;br /&gt;{ &lt;br /&gt;font-family: Courier; &lt;br /&gt;margin:.75em 0; &lt;br /&gt;border:1px solid #596; &lt;br /&gt;border-width:1px 1px; &lt;br /&gt;padding:5px 15px; &lt;br /&gt;display: block; &lt;br /&gt;background-color: #dedede; &lt;br /&gt;white-space: pre; &lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-1077371105142339020?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/1077371105142339020/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=1077371105142339020' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/1077371105142339020'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/1077371105142339020'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2008/02/find-good-free-blog-templates.html' title='Find Good Free Blog Templates'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8963822716151911358.post-4229662791153723791</id><published>2008-02-27T14:45:00.004Z</published><updated>2011-02-09T12:27:11.780Z</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sharepoint'/><category scheme='http://www.blogger.com/atom/ns#' term='Powershell'/><title type='text'>SharePoint stsadm.exe and Powershell</title><content type='html'>Trying to run the SharePoint tool stsadm.exe in PowerSehll I get the following error:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;blockquote&gt;The term 'stsadm.exe' is not recognized as a cmdlet, function, operable program, or script file&lt;/blockquote&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;To get stsadm.exe to work in PowerShell you have to edit the 'profile.ps1' file.&lt;br /&gt;Look in C:\WINDOWS\system32\windowspowershell\v1.0\ and if it doesn't exist just create a new file and add the following code:&lt;br /&gt;&lt;br /&gt;&lt;blockquote&gt;Set-Alias -Name stsadm -Value $env:CommonProgramFiles”\Microsoft Shared\Web Server Extensions\12\BIN\STSADM.EXE”&lt;br /&gt;&lt;/blockquote&gt;&lt;br /&gt;Now you can use stsadm in Powershell without it buggering up.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8963822716151911358-4229662791153723791?l=2000mph.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://2000mph.blogspot.com/feeds/4229662791153723791/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8963822716151911358&amp;postID=4229662791153723791' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/4229662791153723791'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8963822716151911358/posts/default/4229662791153723791'/><link rel='alternate' type='text/html' href='http://2000mph.blogspot.com/2008/02/sharepoint-stsadmexe-and-powershell.html' title='SharePoint stsadm.exe and Powershell'/><author><name>2000MPH</name><uri>http://www.blogger.com/profile/08269768546492324270</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
