<?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-2529134775636635202</id><updated>2011-11-27T16:31:35.984-08:00</updated><category term='Site template'/><category term='Visual Studio'/><category term='ListTemplateId'/><category term='Publishing Infrastructure'/><category term='SharePoint 2007'/><category term='TemplateField'/><category term='SPListItem'/><category term='Site Collection Features'/><category term='GridView'/><category term='List Definition'/><category term='MOSS'/><category term='ObjectDataSource'/><category term='VSeWSS'/><category term='GridView paging'/><category term='ASP.NET'/><title type='text'>Salman's Weblog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://salmanbanani.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2529134775636635202/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://salmanbanani.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Salman</name><uri>http://www.blogger.com/profile/02261737835763052260</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>6</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2529134775636635202.post-8559182305801992014</id><published>2009-10-30T18:34:00.000-07:00</published><updated>2009-10-30T18:57:16.040-07:00</updated><title type='text'>Listening to the wind of change</title><content type='html'>So I decided to quit my job and took up another opportunity with a smaller company.  Was it all about money?  Of course money is a big part of it.  I have got bills to pay. &lt;br /&gt;&lt;br /&gt;But I think it's more than just money.  In every job there comes a time when you just know that this is it!  It doesn't have to be an event that triggers that idea in your head.  It's a little hard to explain.  When the time comes, you just know.  And there are obviously other factors.  How is the job market at the time?  Is there a good offer on the table?  Does it make sense as a career move?  Is there an opportunity to keep learning new things in your current role?  It's a complex decision, and I generally tend to make my decisions more complicated than they should be.  And every time you switch jobs, you have to start from scratch.  It takes a while to get productive in your new role, and that period of low productivity always makes me uneasy. &lt;br /&gt;&lt;br /&gt;The good thing is that you get to learn new things, meet new people, grow your network, and more often than not get more money:-)  I know people who have stayed with their companies for many years, even decades!  That's really amazing for me.  I don't know how they do that.  I haven't been able to stay with a company for more than 2 and a half years (but in that particular case, quitting was just the first of a series of bad choices; I really should've stayed there).  And people think that it varies from industry to industry.  In I.T. (specially in Australia), I think it's normal to find people who switch jobs every two or three years.  But I think staying in a job for a longer period of time does have it's benefits.&lt;br /&gt;&lt;br /&gt;Anyways, I guess there won't be any SharePoint featuring in this blog for a while.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2529134775636635202-8559182305801992014?l=salmanbanani.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salmanbanani.blogspot.com/feeds/8559182305801992014/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salmanbanani.blogspot.com/2009/10/listening-to-wind-of-change.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2529134775636635202/posts/default/8559182305801992014'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2529134775636635202/posts/default/8559182305801992014'/><link rel='alternate' type='text/html' href='http://salmanbanani.blogspot.com/2009/10/listening-to-wind-of-change.html' title='Listening to the wind of change'/><author><name>Salman</name><uri>http://www.blogger.com/profile/02261737835763052260</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-2529134775636635202.post-7585944890532891893</id><published>2009-08-12T20:36:00.000-07:00</published><updated>2009-08-12T21:00:24.035-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='VSeWSS'/><category scheme='http://www.blogger.com/atom/ns#' term='SPListItem'/><category scheme='http://www.blogger.com/atom/ns#' term='SharePoint 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><category scheme='http://www.blogger.com/atom/ns#' term='MOSS'/><title type='text'>This is bizzare!</title><content type='html'>SharePoint is a strange beast. Here is a very simple piece of code:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;private void Form2_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;SPSite site = new SPSite("...");&lt;br /&gt;SPWeb web = site.OpenWeb("...");&lt;br /&gt;SPListItem listitem = web.Lists["FDL1"].Items[0];&lt;br /&gt;&lt;br /&gt;listitem["Title"] = "Changed title";&lt;br /&gt;&lt;br /&gt;listitem.SystemUpdate();&lt;br /&gt;&lt;br /&gt;web.Dispose();&lt;br /&gt;site.Dispose();&lt;br /&gt;} &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This does't work. I get the following error.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Microsoft.SharePoint.SPException was unhandled&lt;br /&gt;Message="Exception from HRESULT: 0x80040E14"&lt;br /&gt;Source="Microsoft.SharePoint"&lt;br /&gt;ErrorCode=-2147217900&lt;br /&gt;StackTrace:&lt;br /&gt;at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32&amp;amp; plID, String&amp;amp; pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object&amp;amp; pvarAttachmentNames, Object&amp;amp; pvarAttachmentContents, Object&amp;amp; pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish)&lt;br /&gt;at Microsoft.SharePoint.SPListItem.AddOrUpdateItem(Boolean bAdd, Boolean bSystem, Boolean bPreserveItemVersion, Boolean bNoVersion, Boolean bMigration, Boolean bPublish, Boolean bCheckOut, Boolean bCheckin, Guid newGuidOnAdd, Int32&amp;amp; ulID, Object&amp;amp; objAttachmentNames, Object&amp;amp; objAttachmentContents, Boolean suppressAfterEvents)&lt;br /&gt;at Microsoft.SharePoint.SPListItem.UpdateInternal(Boolean bSystem, Boolean bPreserveItemVersion, Guid newGuidOnAdd, Boolean bMigration, Boolean bPublish, Boolean bNoVersion, Boolean bCheckOut, Boolean bCheckin, Boolean suppressAfterEvents)&lt;br /&gt;at Microsoft.SharePoint.SPListItem.SystemUpdate()&lt;br /&gt;at ContentTypeMigrator.Form2.Form2_Load(Object sender, EventArgs e) in (...)\Form2.cs:line 34&lt;br /&gt;at System.Windows.Forms.Form.OnLoad(EventArgs e)&lt;br /&gt;at System.Windows.Forms.Form.OnCreateControl()&lt;br /&gt;at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)&lt;br /&gt;at System.Windows.Forms.Control.CreateControl()&lt;br /&gt;at System.Windows.Forms.Control.WmShowWindow(Message&amp;amp; m)&lt;br /&gt;at System.Windows.Forms.Control.WndProc(Message&amp;amp; m)&lt;br /&gt;at System.Windows.Forms.ScrollableControl.WndProc(Message&amp;amp; m)&lt;br /&gt;at System.Windows.Forms.ContainerControl.WndProc(Message&amp;amp; m)&lt;br /&gt;at System.Windows.Forms.Form.WmShowWindow(Message&amp;amp; m)&lt;br /&gt;at System.Windows.Forms.Form.WndProc(Message&amp;amp; m)&lt;br /&gt;at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp;amp; m)&lt;br /&gt;at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp;amp; m)&lt;br /&gt;at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)&lt;br /&gt;at System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)&lt;br /&gt;at System.Windows.Forms.Control.SetVisibleCore(Boolean value)&lt;br /&gt;at System.Windows.Forms.Form.SetVisibleCore(Boolean value)&lt;br /&gt;at System.Windows.Forms.Control.set_Visible(Boolean value)&lt;br /&gt;at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)&lt;br /&gt;at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)&lt;br /&gt;at System.Windows.Forms.Application.Run(Form mainForm)&lt;br /&gt;at ContentTypeMigrator.Program.Main() in (...)\Program.cs:line 18&lt;br /&gt;at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)&lt;br /&gt;at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)&lt;br /&gt;at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()&lt;br /&gt;at System.Threading.ThreadHelper.ThreadStart_Context(Object state)&lt;br /&gt;at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)&lt;br /&gt;at System.Threading.ThreadHelper.ThreadStart()&lt;br /&gt;InnerException: System.Runtime.InteropServices.COMException&lt;br /&gt;Message="Exception from HRESULT: 0x80040E14"&lt;br /&gt;Source="Microsoft.SharePoint.Library"&lt;br /&gt;ErrorCode=-2147217900&lt;br /&gt;StackTrace:&lt;br /&gt;at Microsoft.SharePoint.Library.SPRequestInternalClass.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32&amp;amp; plID, String&amp;amp; pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object&amp;amp; pvarAttachmentNames, Object&amp;amp; pvarAttachmentContents, Object&amp;amp; pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish)&lt;br /&gt;at Microsoft.SharePoint.Library.SPRequest.AddOrUpdateItem(String bstrUrl, String bstrListName, Boolean bAdd, Boolean bSystemUpdate, Boolean bPreserveItemVersion, Boolean bUpdateNoVersion, Int32&amp;amp; plID, String&amp;amp; pbstrGuid, Guid pbstrNewDocId, Boolean bHasNewDocId, String bstrVersion, Object&amp;amp; pvarAttachmentNames, Object&amp;amp; pvarAttachmentContents, Object&amp;amp; pvarProperties, Boolean bCheckOut, Boolean bCheckin, Boolean bMigration, Boolean bPublish)&lt;br /&gt;InnerException: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Courier New;"&gt;&lt;/span&gt;&lt;br /&gt;I have created the list through a VSeWSS List Definition project. There is a field named "Workflow" on my list which is a Choice field. &lt;span style="color:#ff0000;"&gt;If I delete that field, the above code works without any problem!!!&lt;/span&gt; More interesting is the fact that if i recreate that field through SharePoint UI, the code still works!!! It doesn't work if i recreate the list based on the list template that I have created through VSeWSS project.&lt;br /&gt;&lt;br /&gt;I know, this doesn't make any sense. Morale of the story? You really have to learn to think irrationally to deal with the quirks of SharePoint development:-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2529134775636635202-7585944890532891893?l=salmanbanani.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salmanbanani.blogspot.com/feeds/7585944890532891893/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salmanbanani.blogspot.com/2009/08/this-is-bizzare.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2529134775636635202/posts/default/7585944890532891893'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2529134775636635202/posts/default/7585944890532891893'/><link rel='alternate' type='text/html' href='http://salmanbanani.blogspot.com/2009/08/this-is-bizzare.html' title='This is bizzare!'/><author><name>Salman</name><uri>http://www.blogger.com/profile/02261737835763052260</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-2529134775636635202.post-1138849917730210225</id><published>2009-08-10T22:36:00.000-07:00</published><updated>2009-08-10T22:53:09.044-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ListTemplateId'/><category scheme='http://www.blogger.com/atom/ns#' term='List Definition'/><category scheme='http://www.blogger.com/atom/ns#' term='VSeWSS'/><category scheme='http://www.blogger.com/atom/ns#' term='SharePoint 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><category scheme='http://www.blogger.com/atom/ns#' term='MOSS'/><title type='text'>A feature 'Receivers' element must have attribute 'ListTemplateId'.</title><content type='html'>Problem:&lt;br /&gt;&lt;br /&gt;You create a List Definition in Visual Studio using Visual Studio 2008 extensions for Windows SharePoint Services 3.0 (VSeWSS), and when you try to deploy the list definition, you get the following error:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;A feature 'Receivers' element must have attribute 'ListTemplateId'.&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;In this particular case, I got this error when I created an "ItemAdded" event in ItemEventReceiver.cs file.&lt;br /&gt;&lt;br /&gt;Solution:&lt;br /&gt;&lt;br /&gt;Open ItemEventReceiver.xml. Add the attribute ListTemplateId as shown below.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&lt;br /&gt;&amp;lt;Elements Id="f2e3e6da-ada5-4ca7-af3a-25f7f563ea08" xmlns="http://schemas.microsoft.com/sharepoint/"&amp;gt;&lt;br /&gt;&amp;lt;Receivers ListTemplateOwner="e7d14ad5-e29e-4910-a0a6-93181a59c7c7" &lt;strong&gt;&lt;span style="color:#3333ff;"&gt;ListTemplateId="100"&lt;/span&gt;&lt;/strong&gt;&amp;gt;&lt;br /&gt;&amp;lt;Receiver&amp;gt;&lt;br /&gt;&amp;lt;Name&amp;gt;ItemAdded&amp;lt;/Name&amp;gt;&lt;br /&gt;&amp;lt;Type&amp;gt;ItemAdded&amp;lt;/Type&amp;gt;&lt;br /&gt;&amp;lt;SequenceNumber&amp;gt;1&amp;lt;/SequenceNumber&amp;gt;&lt;br /&gt;&amp;lt;Class&amp;gt;f2e3e6da-ada5-4ca7-af3a-25f7f563ea08&amp;lt;/Class&amp;gt;&lt;br /&gt;&amp;lt;/Receiver&amp;gt;&lt;br /&gt;&amp;lt;/Receivers&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;&amp;lt;/Elements&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;That will fix the error, and you can deploy the List Definition without any errors.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2529134775636635202-1138849917730210225?l=salmanbanani.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salmanbanani.blogspot.com/feeds/1138849917730210225/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salmanbanani.blogspot.com/2009/08/feature-receivers-element-must-have.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2529134775636635202/posts/default/1138849917730210225'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2529134775636635202/posts/default/1138849917730210225'/><link rel='alternate' type='text/html' href='http://salmanbanani.blogspot.com/2009/08/feature-receivers-element-must-have.html' title='A feature &apos;Receivers&apos; element must have attribute &apos;ListTemplateId&apos;.'/><author><name>Salman</name><uri>http://www.blogger.com/profile/02261737835763052260</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-2529134775636635202.post-5119409282651838880</id><published>2009-08-10T20:11:00.000-07:00</published><updated>2009-08-10T22:50:14.397-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Site Collection Features'/><category scheme='http://www.blogger.com/atom/ns#' term='Site template'/><category scheme='http://www.blogger.com/atom/ns#' term='SharePoint 2007'/><category scheme='http://www.blogger.com/atom/ns#' term='MOSS'/><category scheme='http://www.blogger.com/atom/ns#' term='Publishing Infrastructure'/><title type='text'>"Publishing Site" option is missing from "Select a template" list when you try to create a new site in SharePoint 2007</title><content type='html'>&lt;a href="http://2.bp.blogspot.com/_IaIR5FPDIMc/SoDjJk61ciI/AAAAAAAAABI/bmI7mZeiAdE/s1600-h/PublishingSite.jpg"&gt;&lt;img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 320px; height: 220px;" src="http://2.bp.blogspot.com/_IaIR5FPDIMc/SoDjJk61ciI/AAAAAAAAABI/bmI7mZeiAdE/s320/PublishingSite.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5368540509494407714" /&gt;&lt;/a&gt;&lt;br /&gt;Problem:&lt;br /&gt;&lt;br /&gt;When you are trying to create a new SharePoint publishing site, you don't see the "Publishing Site" option in the template list.&lt;br /&gt;&lt;br /&gt;Solution:&lt;br /&gt;&lt;br /&gt;You have to activate publishing infrastructure on site collection level.  This is how you can do this:&lt;br /&gt;&lt;br /&gt;stsadm -o activatefeature -name PublishingPrerequisites -url &lt;url&gt;&lt;br /&gt;stsadm -o activatefeature -name PublishingResources -url &lt;url&gt;&lt;br /&gt; &lt;br /&gt;And then activate Office SharePoint Server Publishing Infrastructure under site collection features.&lt;br /&gt;&lt;br /&gt;Hope this helps:-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2529134775636635202-5119409282651838880?l=salmanbanani.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salmanbanani.blogspot.com/feeds/5119409282651838880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salmanbanani.blogspot.com/2009/08/publishing-site-option-is-missing-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2529134775636635202/posts/default/5119409282651838880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2529134775636635202/posts/default/5119409282651838880'/><link rel='alternate' type='text/html' href='http://salmanbanani.blogspot.com/2009/08/publishing-site-option-is-missing-from.html' title='&quot;Publishing Site&quot; option is missing from &quot;Select a template&quot; list when you try to create a new site in SharePoint 2007'/><author><name>Salman</name><uri>http://www.blogger.com/profile/02261737835763052260</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><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_IaIR5FPDIMc/SoDjJk61ciI/AAAAAAAAABI/bmI7mZeiAdE/s72-c/PublishingSite.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2529134775636635202.post-3808315211802013701</id><published>2009-08-08T00:59:00.000-07:00</published><updated>2009-08-11T21:49:23.811-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GridView paging'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='GridView'/><category scheme='http://www.blogger.com/atom/ns#' term='TemplateField'/><category scheme='http://www.blogger.com/atom/ns#' term='ObjectDataSource'/><title type='text'>Using Template Fields inside ASP.NET GridView control</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_IaIR5FPDIMc/Sn1Cokgz8-I/AAAAAAAAAA8/7Wfnng2X8iM/s1600-h/Image1.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 317px;" src="http://1.bp.blogspot.com/_IaIR5FPDIMc/Sn1Cokgz8-I/AAAAAAAAAA8/7Wfnng2X8iM/s320/Image1.JPG" alt="" id="BLOGGER_PHOTO_ID_5367519595658998754" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_IaIR5FPDIMc/Sn1ChYrvhgI/AAAAAAAAAA0/dm0lFiKyESE/s1600-h/Image2.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 320px; height: 317px;" src="http://4.bp.blogspot.com/_IaIR5FPDIMc/Sn1ChYrvhgI/AAAAAAAAAA0/dm0lFiKyESE/s320/Image2.JPG" alt="" id="BLOGGER_PHOTO_ID_5367519472224536066" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Download the source code from &lt;a href="http://www.box.net/shared/tt96662lex"&gt;here&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;If you have done anything with ASP.NET, you would probably agree that GridView is a very useful control.  I am a big fan of TemplateFields.  They give you flexibility to display a mix of HTML and Web controls with complete control over how you want to show them.&lt;br /&gt;&lt;br /&gt;I have created a Visual Web Developer 2008 Express project which you can download  from &lt;a href="http://www.box.net/shared/tt96662lex"&gt;here&lt;/a&gt;.  It shows you how to use TemplateFields.  Feel free to download it and have a play with it.&lt;br /&gt;&lt;br /&gt;The first page (Sample.aspx) in this project has a fairly standard looking GridView.  You can sort on any column, and paging is also enabled.  Sorry about the crappy data:-)  One thing you might find interesting is that you can enable/disable a “Campaign” by clicking the “Enable” link button in the row.  This changes the image in the first column of the row, showing the current status of a campaign.  Simple stuff, but could be useful in some situations.  Also, the page combo box in the pager row takes you to the selected page directly.  The gridview is bound to an ObjectDataSource.  You’ll also find a minimalist DAL in this project, but for anything serious you should probably be using the Enterprise Library Data Access Block.&lt;br /&gt;&lt;br /&gt;I know that it’s fairly easy to do all this without using TemplateFields, but I guess this does demonstrate that you can use TemplateFields in almost any scenario with grid view.  But yeah, I agree that template fields are an overkill here.&lt;br /&gt;&lt;br /&gt;The second sample (Sample2.aspx) in this project is a little more interesting.  You’ll see that I have used a template field to show information the way I want to.  I have put a bunch of Web controls in an ASP.NET table.  There is a drop down, a few checkboxes and textboxes.  You can change the values in any gridview row, and simply hit the “Update” link button.  I like this style of gridview better than the first one (Sample.aspx), where first you have to hit the edit link button to get the editable textboxes in the row before you can edit the row.  In sample2.aspx, you have the row in Edit mode by default.&lt;br /&gt;&lt;br /&gt;Here is a very interesting behaviour.  In the first sample (sample.aspx), if you make the first row of the first page editable, and then move to the second page without hitting the update or cancel link buttons, the first row of second page appears in edit mode!  I am sure there is a way to fix this:-)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2529134775636635202-3808315211802013701?l=salmanbanani.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salmanbanani.blogspot.com/feeds/3808315211802013701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salmanbanani.blogspot.com/2009/08/using-template-fields-inside-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2529134775636635202/posts/default/3808315211802013701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2529134775636635202/posts/default/3808315211802013701'/><link rel='alternate' type='text/html' href='http://salmanbanani.blogspot.com/2009/08/using-template-fields-inside-aspnet.html' title='Using Template Fields inside ASP.NET GridView control'/><author><name>Salman</name><uri>http://www.blogger.com/profile/02261737835763052260</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><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_IaIR5FPDIMc/Sn1Cokgz8-I/AAAAAAAAAA8/7Wfnng2X8iM/s72-c/Image1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2529134775636635202.post-5848140445558001167</id><published>2009-08-08T00:54:00.000-07:00</published><updated>2009-08-08T00:58:15.036-07:00</updated><title type='text'>To blog or not to blog</title><content type='html'>I have been thinking of having a blog for a while.  For one reason or another, I kept delaying it (and the biggest reason was simply the fact that I am too lazy).  I think the most compelling reason for me to start a blog at the moment is that, I want to make stuff easier for me to find!  I keep a track of interesting links in my Google toolbar, and the bookmark list has grown to a point where it is becoming almost unmanageable.   Plus, sometimes it's convenient to have the code that I have written in the past available online...  May be someone else will find this collection useful too.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2529134775636635202-5848140445558001167?l=salmanbanani.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salmanbanani.blogspot.com/feeds/5848140445558001167/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salmanbanani.blogspot.com/2009/08/to-blog-or-not-to-blog.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2529134775636635202/posts/default/5848140445558001167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2529134775636635202/posts/default/5848140445558001167'/><link rel='alternate' type='text/html' href='http://salmanbanani.blogspot.com/2009/08/to-blog-or-not-to-blog.html' title='To blog or not to blog'/><author><name>Salman</name><uri>http://www.blogger.com/profile/02261737835763052260</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>
