title: Using Knockout bindings in MVC ActionLink
body: <p>I am attempting to utilise KnockoutJS and MVC 4 in order to display a table with <code>ActionLink</code> definitions in the first column of the table.  Displaying the data itself is extremely straight-forward and I'm not having any problem there.  The problem I have is in the generation of the <code>ActionLink</code>'s.</p>
  
  <p>I have taken a look at <a href="https://stackoverflow.com/questions/6989080/asp-net-mvc-helpers-inside-knockout-jquery-tmpl-templates">Use MVC helpers inside jquery.tmpl templates</a>, but the solution there does not utilise knockout templates and inserting the Url into the model object is not feasible (the app domain model objects used to create the view model will be used extensively through out the application).</p>
  
  <p>The table definition:</p>
  
  <pre><code>&lt;table&gt;
      &lt;tbody data-bind="template: { name: 'dmuTableDetail', foreach: tables() }"&gt;&lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>(<code>tables</code> is an observable array, hence the parens).</p>
  
  <p>The knockout template definition:</p>
  
  <pre><code>&lt;script id="dmuTableDetail" type="text/html"&gt;
      &lt;tr&gt;
          &lt;td&gt;@Html.ActionLink("Details", "Details", "DMUTableCategory", new { @Id = ??? } )&lt;/td&gt;
          &lt;td data-bind="text:TableId"&gt;&lt;/td&gt;
          &lt;td data-bind="text:TableName"&gt;&lt;/td&gt;
      &lt;/tr&gt;
  &lt;/script&gt;​
  </code></pre>
  
  <p>The View Model definition:</p>
  
  <pre><code>var PageViewModel = function () {
      self = this;
  
      self.tables = ko.observableArray([]);
  
      self.readItems = function () {
          self.tables(jQuery.parseJSON('[{"TableId":1001, "TableName":"Table#1"},{"TableId":1002, "TableName":"Table#2"}]'));
      }
  }
  
  $(document).ready(function () {
      vm = new PageViewModel();
      self.readItems('');
      ko.applyBindings(vm);
  });
  </code></pre>
  
  <p>(the actual code performs an Ajax call to retrieve the data, but the code above also demonstrates the issue).</p>
  
  <p>Regardless of what I replace the <code>???</code> with, I am unable to get the value of the <code>TableId</code> field to be inserted into the href.</p>
  
  <p>Any help would be greatly appreciated.</p>
  
  <p>Thankyou.</p>