title: pass value from viewbag or viewdata to jquery
body: <p>I created an application, in which I want to pass a value from <code>ViewBag</code> or <code>ViewData</code> to jQuery. Why is the value in jQuery  always null?? This is my code:</p>
  
  <p>My Controller</p>
  
  <pre><code>var data =  _RoomRateService.GetDataForEdit(
                                        Convert.ToInt32(Session["RoomTypeID"]),
                                        Breakfast);
  
  var insertNewRate = _RoomRateService.insertNewRateFromList(
                      Convert.ToString(Session["RoomTypeID"]), 
                      Breakfast, 
                      CheckInTo, 
                      data.CurrCode, 
                      SingleRate, 
                      DoubleRate,
                      TripleRate, 
                      Commission, 
                      Allotment, 
                      CloseSelling, FreeSell);
  
  ViewBag.test = data.RoomType.RoomTypeName;
  </code></pre>
  
  <p>My jQuery</p>
  
  <pre><code>if(RoomTypeName == "")
       {
          tr.find("#lblRoomType-"+$(this).attr('id')).text("@ViewBag.Test");
       }
       else
       {
          tr.find("#lblRoomType-"+$(this).attr('id')).text(RoomTypeName);
       }
  </code></pre>
  
  <p>Can some one tell me where's my fault?</p>