title: Sharepoint Guidfield - how to display it in frontend and set its value in code?
body: <p>On a custom form of mine I want to display a custom Guid field.</p>
  
  <p>I created the field the usual way via a feature:</p>
  
  <pre><code>&lt;Field ID="88813c02-799b-4fc8-8ed8-72fe668e257c" Type="Guid"
                                                   Name="myGuid"
                                                   StaticName="myGuid"
                                                   DisplayName="My Guid" /&gt;
  </code></pre>
  
  <p>This field I want first set via code and display on a form. On the form I have the following control (for reference I also include a title field):</p>
  
  <pre><code>&lt;SharePoint:GuidField runat="server" ID="myGuidField" FieldName="myGuid" /&gt;
  &lt;SharePoint:TextField runat="server" ID="myTitle" FieldName="Title" /&gt;
  </code></pre>
  
  <p>The Guid field doesn't display on a regular New/Edit form - it's simply empty. In the code behind of the custom form I can do the following:</p>
  
  <pre><code>myTitle.Value = "Some Title Value"; 
  string testValue = myTitle.Value; //--&gt;"Some Title Value"
  </code></pre>
  
  <p>but when trying to set the value of the Guid field - it somehow cannot be done:</p>
  
  <pre><code>string anotherValue = myGuidField.Value; //--&gt; null
  Guid myGuid = new Guid("7f824c3f-4049-4034-a231-85291fce2680");
  myGuidField.Value = myGuid;
  string anotherValue = myGuidField.Value; //--&gt; still null
  //but myGuidField is seen as a "Microsoft.Sharepoint.WebControls.GuidField"
  </code></pre>
  
  <p>So somehow I'm just not able to set the Guid value programmatically and I'm neither able to only display the Guid.</p>
  
  <p><strong>Two questions:</strong></p>
  
  <ol>
  <li>How to display a GuidField (the GUID it contains) on a form?</li>
  <li>How to set the value of a <a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.webcontrols.guidfield.aspx" rel="nofollow">GuidField</a></li>
  </ol>