<?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-8474591</id><updated>2012-01-10T20:36:43.883-08:00</updated><category term='SharePoint 2010'/><title type='text'>LOBO</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://uberego.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8474591/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://uberego.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>lobo</name><uri>http://www.blogger.com/profile/17042801854831152712</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>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8474591.post-823735128265382860</id><published>2012-01-10T20:36:00.000-08:00</published><updated>2012-01-10T20:36:43.893-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SharePoint 2010'/><title type='text'>!New tag in SharePoint 2010</title><content type='html'>SharePoint offers a !New tag for content that it considers to be new.  It's a reasonably well-liked feature, it's out of the box, but how do you use it?&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;There are (at least) two things that you can do with it:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;1)  you can change what it means to be "new"&lt;/div&gt;&lt;div&gt;2) you can reuse the concept in a visual web part, or in other parts of your code&lt;br /&gt;&lt;br /&gt;For the first item, changing what it means to be "new", you can either &lt;a href="http://technet.microsoft.com/en-us/library/cc287681(office.12).aspx"&gt;change the number of days for the new tag&lt;/a&gt;, or you can &lt;a href="http://support.microsoft.com/default.aspx?scid=kb;en-us;825510&amp;amp;Product=spts"&gt;remove the new tag altogether&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;For the second item, reusing the concept, you could &lt;a href="http://sharethelearning.blogspot.com/2007/06/how-to-display-new-icon-against-list.html"&gt;use the new tag in an XSLT or data view web part&lt;/a&gt;, or you can use it in a visual web part. &amp;nbsp;Since I did not find out how to do the latter in any other blog, I'll detail it below:&lt;br /&gt;&lt;br /&gt;First, in code behind, you can determine the number of days that an item is considered to be new:&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;int daysToShowNew = SPContext.Current.Site.WebApplication.DaysToShowNewIndicator;&lt;br /&gt;&lt;br /&gt;Then you can use this property to selectively show the new tag next to some content that you are displaying in your visual web part. &amp;nbsp;I used in a roll up web part that was showing announcements from a number of subsidiary sites, but it can be used anywhere.&lt;br /&gt;&lt;br /&gt;It's somewhat a matter of coding style, but I like to separate the UI from the code, so my approach was to first create a property that can be accessed by the ASPX/ASCX:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; protected bool IsNew(string created)&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DateTime createdDate = DateTime.Parse(created);&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return createdDate.Date.AddDays(daysToShowNew) &amp;gt; DateTime.Today;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;&lt;br /&gt;And then access it in my ASPX/ASCX, modifying the default HTML for this component:&lt;br /&gt;&lt;br /&gt;&amp;lt;img class="ms-newgif" title="New" alt="New" src="/_layouts/1033/images/new.gif" visible="&amp;lt;%# IsNew(DataBinder.Eval(Container.DataItem,"Created").ToString()) %&amp;gt;" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8474591-823735128265382860?l=uberego.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://uberego.blogspot.com/feeds/823735128265382860/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8474591&amp;postID=823735128265382860' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8474591/posts/default/823735128265382860'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8474591/posts/default/823735128265382860'/><link rel='alternate' type='text/html' href='http://uberego.blogspot.com/2012/01/new-tag-in-sharepoint-2010.html' title='!New tag in SharePoint 2010'/><author><name>lobo</name><uri>http://www.blogger.com/profile/17042801854831152712</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>
