<?xml version="1.0" encoding="UTF-8"?>
<entries type="array">
  <entry>
    <category-id type="integer">6</category-id>
    <content>&lt;p&gt;Sometimes on display, when we have fields that may contain long text, we want to truncate the max length that is displayed on screen. It is easy to do this. First change the column into a Template, then when binding call a function you define.&lt;/p&gt;
&lt;pre name="code" class="csharp"&gt;
// put this method in your code behind
protected string TruncateString(object stringToValidate)
		{
			string output = Convert.ToString(stringToValidate);
			
			if (output.Length &gt; 30)
			{
				return output.Substring(0, 30) + "...";
			}
			else
			{
				return output;
			}
		}
&lt;/pre&gt;
&lt;p&gt;Now in your template in the RadGrid, simply do this when outputting the text: &lt;br/&gt;
&lt;b&gt;TruncateString(Eval("PartnerNotes"))&lt;/b&gt; &lt;/p&gt;</content>
    <created-at type="datetime">2010-02-05T15:10:10-08:00</created-at>
    <id type="integer">55</id>
    <title>Truncate String in RadGrid or GridView</title>
    <updated-at type="datetime">2010-02-05T15:43:12-08:00</updated-at>
  </entry>
  <entry>
    <category-id type="integer">1</category-id>
    <content>&lt;p&gt;To limit users and roles to different folders it is pretty easy. First make sure you have your membership and role providers configured and working ok. Then edit the web.config.
Microsoft has a perfect article here: &lt;a href="http://msdn.microsoft.com/en-us/library/8aeskccd.aspx"&gt;deny elements for authorization&lt;/a&gt;
&lt;/p&gt;
&lt;pre name="code" class="xml"&gt;
// this example will limit access to folder Admin to only admin role users.
// note the order is important, if not won't work.
&lt;location path="Admin"&gt;
	&lt;system.web&gt;
		&lt;authorization&gt;
			&lt;allow roles="admin"&gt;&lt;/allow&gt;
			&lt;deny users="*"&gt;&lt;/allow&gt;
		&lt;/authorization&gt;
	&lt;/system.web&gt;
&lt;/location&gt;
&lt;/pre&gt;</content>
    <created-at type="datetime">2010-01-22T10:15:39-08:00</created-at>
    <id type="integer">54</id>
    <title>Allow deny users and roles web.config</title>
    <updated-at type="datetime">2010-01-22T10:22:52-08:00</updated-at>
  </entry>
  <entry>
    <category-id type="integer">6</category-id>
    <content>&lt;p&gt;With Telerik RadGrid, when you hit the &lt;span&gt;Add New Record&lt;/span&gt; and the editable form comes up, the first textbox or dropdown is not selected focused by default. This code will do this. Attaches to Behavior: ItemDataBound&lt;/p&gt;

&lt;pre name="code" class="csharp"&gt;
protected void RadGridServiceTypes_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
		if (e.Item is Telerik.Web.UI.GridEditableItem &amp;&amp; e.Item.IsInEditMode)
		{
			Telerik.Web.UI.GridEditableItem form = (Telerik.Web.UI.GridEditableItem)e.Item;
			TextBox comboBox = (TextBox)form["ServiceName"].Controls[1];
			comboBox.Focus();
		}
}
&lt;/pre&gt;</content>
    <created-at type="datetime">2010-01-20T13:02:41-08:00</created-at>
    <id type="integer">53</id>
    <title>Focus Grid Edit Item on Insert or Edit</title>
    <updated-at type="datetime">2010-01-20T13:04:22-08:00</updated-at>
  </entry>
  <entry>
    <category-id type="integer">1</category-id>
    <content>&lt;p&gt;
This is pretty easy once you know what you are doing:&lt;br/&gt;
&lt;pre name="code" class="csharp"&gt;
DateTime newYorkTime = TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow, TimeZoneInfo.FindTimeZoneById("US Eastern Standard Time"));
&lt;/pre&gt;
&lt;/p&gt;
&lt;p&gt;
BTW it is a good idea to keep times in the database in UTC that way it is easy to convert using above.
&lt;/p&gt;</content>
    <created-at type="datetime">2010-01-15T23:26:10-08:00</created-at>
    <id type="integer">52</id>
    <title>Convert DateTime TimeZone from UTC</title>
    <updated-at type="datetime">2010-01-15T23:26:50-08:00</updated-at>
  </entry>
  <entry>
    <category-id type="integer">1</category-id>
    <content>&lt;p&gt;
Great article on msdn on how to do this: &lt;a href="http://msdn.microsoft.com/en-us/library/cc668201.aspx"&gt;http://msdn.microsoft.com/en-us/library/cc668201.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;If you are using &lt;b&gt;Session&lt;/b&gt; in your code that is routed to, you will need to add this line to your web.config under system.webserver -&gt; modules - &lt;br /&gt;&lt;br/&gt;
&lt;pre name="code" class="xml"&gt;
&lt;system.webServer&gt;
&lt;modules runAllManagedModulesForAllRequests="true"&gt;
    your other stuff in here
&lt;/modules&gt;
&lt;/system.webServer&gt;
&lt;/pre&gt;
&lt;/p&gt;</content>
    <created-at type="datetime">2009-12-16T15:29:42-08:00</created-at>
    <id type="integer">51</id>
    <title>Configuring ASP .NET Routing</title>
    <updated-at type="datetime">2009-12-16T15:31:31-08:00</updated-at>
  </entry>
  <entry>
    <category-id type="integer">5</category-id>
    <content>&lt;p&gt;We often have variable width objects in a page, like Buttons or images that we need to center. I came across this article that explains it well: &lt;a href="http://www.tightcss.com/centering/center_variable_width.htm"&gt;Centering Variable Width Content&lt;/a&gt;
&lt;/p&gt;</content>
    <created-at type="datetime">2009-12-11T11:08:11-08:00</created-at>
    <id type="integer">50</id>
    <title>CSS Center Variable Width Div</title>
    <updated-at type="datetime">2009-12-11T11:08:11-08:00</updated-at>
  </entry>
</entries>
