title: passing asp.net mvc model variables to html data attribute
body: <p>What is the best way to pass mvc model variables to html data attribute to create a json attribute.</p>
  
  <p>Basically I want to achieve the below to create the event json</p>
  
  <pre><code>    &lt;div class='fc-event' data-event='{"title":"my 
     event","id":8,"taskId":444}'&gt;Hello&lt;/div&gt;
  </code></pre>
  
  <p>I want to replace the above static values to variables while in a loop.
  The below doesn't work</p>
  
  <pre><code>            @if (Model.Count() &gt; 0)
                  {
                      @foreach (var item in Model)
                      {
    &lt;div class='fc-event' data-event= '{"title":@Html.DisplayFor(m =&gt; 
     item.Name)}'  &gt; Test&lt;/div&gt;
  </code></pre>