title: How to pass a string from LINQ query to ViewBag
body: <p>I am trying to dynamically generate a title for my page. I'm using this query to select an item type:</p>
  
  <pre><code>ViewBag.itemType = From row In db.tblCategories
                     Where row.Item_Type_Identifier = itemType
                     Select CStr(row.Item_Type)
                     Distinct
  </code></pre>
  
  <p>And in my view I'm trying to display it like so:</p>
  
  <pre><code>&lt;h2&gt;Details for @ViewBag.itemType &lt;/h2&gt;
  </code></pre>
  
  <p>Instead of my view displaying the value retrieved from the query I am seeing the LINQ query actually being displayed like so:</p>
  
  <pre><code>SELECT [Distinct1].[Item_Type] AS [Item_Type] 
  FROM ( SELECT DISTINCT [Extent1].[Item_Type] 
  AS [Item_Type] FROM [dbo].[tblCategories] AS [Extent1] 
  WHERE [Extent1].[Item_Type_Identifier] = @p__linq__0 ) 
  AS [Distinct1]  
  </code></pre>
  
  <p>I've attempted to place the value from the query in a variable, and then add that variable to <code>ViewData</code> and then retrieve that value in the view.  </p>
  
  <p>I've attempted to use <code>.ToString</code> on my LINQ instead of casting <code>CStr</code>.  </p>
  
  <p>Why is my query being placed in my <code>ViewBag</code> instead of the value my LINQ returns?</p>