dataTables submit filtered on search RRS feed

  • Question

  • Hello

    I have a table that is populated by using a for loop and contains text boxes that can be edited and the changes can be posted back to the server. It works fine unless I filter the table using the search bar which posts back to the model as null. Im assuming it is because I need to reinitialise the table with the filter values but im not sure how to do this while keeping it editable at the same time.

    <table id="datatable-nic" class="table table-condensed no-footer datatable-basic-noPage">
                                  <th>Letter Type</th>
                                  <th>Mail Type</th>
                                  <th>Print Cost </th>
                                  <th>Fulfilment Cost</th>
                                  <th>Postage Cost</th>
                          <tbody id="myTable">
                              @for (int i = 0; i < Model.Count; i++)
                                      @Html.HiddenFor(m => Model[i].LetterType, new { @class = "form-control", @readonly = "readonly" })
                                      <td class="exp" data-search='@Model[i].Description'>@Html.TextBoxFor(m => Model[i].Description, new { @class = "form-control", @readonly = "readonly" })</td>
                                      <td data-search='@Model[i].LetterType'>@Html.TextBoxFor(m => Model[i].LetterType, new { @class = "form-control", @readonly = "readonly" })</td>
                                      <td data-search='@Model[i].MailType'>@Html.TextBoxFor(m => Model[i].MailType, new { @class = "form-control", @readonly = "readonly" })</td>
                                      <td data-search='@Model[i].Fold'>@Html.TextBoxFor(m => Model[i].Fold, new { @class = "form-control", @readonly = "readonly" })</td>
                                      <td data-search='@Model[i].PrintCost'>@Html.TextBoxFor(m => Model[i].PrintCost, new { @class = "form-control", autocomplete = "off" })</td>
                                      <td data-search='@Model[i].FulfilmentCost'>@Html.TextBoxFor(m => Model[i].FulfilmentCost, new { @class = "form-control", autocomplete = "off" })</td>
                                      <td data-search='@Model[i].PostageCost'>@Html.TextBoxFor(m => Model[i].PostageCost, new { @class = "form-control", autocomplete = "off" })</td>
                              <div class="col-md-12 col-sm-12">
                                  <button type="submit" class="btn btn-success pull-right">class="fa fa-check"> Submit</button>
          @section scripts{
          <script src="~/Scripts/select2.min.js"></script>
          <script src="~/Scripts/DataTables/datatables.min.js"></script>

    Thanks for reading , any help is appreciated.

    Wednesday, January 23, 2019 4:05 PM

All replies

  • Hello,

    On the C# side use the Visual Studio debugger via setting a breakpoint and stepping through the code. Also consider using Fiddler to monitor what goes across the wire in regards to your post.

    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Wednesday, January 23, 2019 4:34 PM
  • Hi NicoleStrain,

    Thank you for posting here.

    For your question, what is the type of your project? 

    If it is ASP.NET, you could post a new thread in ASP.NET forum for suitable support.


    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, January 24, 2019 2:00 AM
  • Hello

    Thanks for your help ill post there 

    Thursday, January 24, 2019 8:06 AM