title: How to reordering table row in ASP.Net MVC3 using jquery without using any plugin?
body: <pre><code>I am using datatable plugin in my ASP.Net MVC3 project. Here I have to implement the row reordering. I used "jQuery.dataTables.rowReordering.js" plugin to implement it. For ui its working fine, but It failed to call server side function.
  </code></pre>
  
  <p>I am using datatable plugin in my ASP.Net MVC3 project. Here I have to implement the row reordering. I used "jQuery.dataTables.rowReordering.js" plugin to implement it. For ui its working fine, but It failed to call server side function.</p>
  
  <p>I am using datatable plugin in my ASP.Net MVC3 project. Here I have to implement the row reordering. I used "jQuery.dataTables.rowReordering.js" plugin to implement it. For ui its working fine, but It failed to call server side function.</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
      $(document).ready(function () {
  $('#myDataTable').dataTable().rowReordering({sURL: "/AdminArea/UpdateOrder" });
      });
  
  &lt;/script&gt;
  
  my controller code is   
  
  
  public void UpdateOrder( int id, int fromPosition, int toPosition, string direction )
      {
  
          if( direction == "back" )
          {
              var movedCompanies = objEpisodeDL.GetAllSegmentsByEpisodeId( 2 )
                          .Where( c =&gt; ( toPosition &lt;= c.DisplayOrder &amp;&amp; c.DisplayOrder &lt;= fromPosition ) )
                          .ToList();
  
              foreach( var company in movedCompanies )
              {
                  company.DisplayOrder++;
              }
          }
          else
          {
              var movedCompanies = objEpisodeDL.GetAllSegmentsByEpisodeId( 2 )
                          .Where( c =&gt; ( fromPosition &lt;= c.DisplayOrder &amp;&amp; c.DisplayOrder &lt;= toPosition ) )
                          .ToList();
              foreach( var company in movedCompanies )
              {
                  company.DisplayOrder--;
              }
          }
  
          objEpisodeDL.GetAllSegmentsByEpisodeId( 2 ).First( c =&gt; c.Id == id ).DisplayOrder = toPosition;
  
      }
  </code></pre>
  
  <p>view is-</p>
  
  <pre><code>&lt;table id="myDataTable"&gt;
  &lt;thead&gt;
      &lt;tr&gt;
          &lt;th&gt;
              OrderNo
          &lt;/th&gt;        
          &lt;th&gt;
              SubArea
          &lt;/th&gt;
          &lt;th&gt;
              Description
          &lt;/th&gt;        
  
      &lt;/tr&gt;
  &lt;/thead&gt;
   &lt;tbody&gt;
  @{
      if (@ViewData["SubAreaForArea"] != null)
      {
          IEnumerable&lt;GridDragAndDrop.Models.SubAreaForAdmin&gt; subarea = ViewData["SubAreaForArea"] as IEnumerable&lt;GridDragAndDrop.Models.SubAreaForAdmin&gt;;
  
          foreach (var item in subarea)
          {
              &lt;tr class="order"&gt;
                  &lt;td&gt;
                      @Html.DisplayFor(modelItem =&gt;item.OrderNo)
                  &lt;/td&gt;
                  &lt;td&gt;
                      @Html.DisplayFor(modelItem =&gt; item.SubArea)
                  &lt;/td&gt;
                  &lt;td&gt;
                      @Html.DisplayFor(modelItem =&gt; item.Description)
                  &lt;/td&gt;
              &lt;/tr&gt;
          }
      }
  }
  &lt;/tbody&gt;
  &lt;/table&gt;
  </code></pre>