Advertisement
mota57

_IndexQuestionFoo.cshtml

Feb 26th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 4.38 KB | None | 0 0
  1. @model PagedList.IPagedList<WebApp.Models.QuestionsFoo>
  2. @using PagedList.Mvc;
  3.  
  4. @{
  5.     ViewBag.Title = "Questions Foo";
  6.     Layout = null;
  7. }
  8.  
  9. <p>
  10.     <a href="@Url.Action("Create", "QuestionFoo")" class="btn btn-primary">
  11.         New
  12.     </a>
  13. </p>
  14. @using (Ajax.BeginForm("Index", "Preguntas_Anamnesis",new AjaxOptions { HttpMethod = "POST" } , new { id = "formSearchQuestionFoo"}))
  15. {
  16.     <p>
  17.         Buscar @Html.TextBox("SearchString")
  18.         <button type="submit" value="Buscar" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span></button>
  19.     </p>
  20. }
  21.  
  22.  
  23.                         <table class="table">
  24.                             <tr>
  25.                                 <th>
  26.                                     Clinica
  27.                                 </th>
  28.                                 <th>
  29.                                     @Ajax.ActionLink("Question","Index","QuestionFoo",null, new AjaxOptions { UpdateTargetId = "viewHtml"},null)
  30.                                 </th>
  31.                                 <th>
  32.                                   Pregunta Force
  33.                                 </th>
  34.                                 <th>
  35.                                     Status
  36.                                 </th>
  37.                                 <th></th>
  38.                             </tr>
  39.  
  40.                             @foreach (var item in Model)
  41.                             {
  42.                                 <tr>
  43.                                     <td>
  44.                                         @Html.DisplayFor(modelItem => item.Clinica.Descripcion_Clinica)
  45.                                     </td>
  46.                                     <td>
  47.                                         @Html.DisplayFor(modelItem => item.Pregunta)
  48.                                     </td>
  49.                                     <td>
  50.                                         @Html.DisplayFor(modelItem => item.Pregunta_Forzada)
  51.                                     </td>
  52.                                     <td>
  53.                                         @Html.DisplayFor(modelItem => item.Status.Descripcion_Status)
  54.                                     </td>
  55.                                     <td>
  56.                                         @Html.ActionLink("Editar", "Edit","QuestionFoo", new { id = item.IDPregunta }) |
  57.                                         @Html.ActionLink("Detalles", "Details","QuestionFoo", new { id = item.IDPregunta }) |
  58.                                         @Html.ActionLink("Eliminar", "Delete","QuestionFoo", new { id = item.IDPregunta })
  59.                                     </td>
  60.                                 </tr>
  61.                             }
  62.                         </table>
  63.  
  64. Pagina @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber) de @Model.PageCount
  65.  
  66.  
  67.  
  68. @Html.PagedListPager(Model, page => "javascript:void(0)",
  69.                                     new PagedListRenderOptions
  70.                                     {
  71.                                         FunctionToTransformEachPageLink = (liTag, aTag) =>
  72.                                         {
  73.                                             aTag.Attributes.Add("data-page", aTag.InnerHtml);
  74.                                             aTag.Attributes.Add("class", "pageQuestionFoo");
  75.                                             liTag.InnerHtml = aTag.ToString(); return liTag;
  76.                                         }
  77.                                     })
  78. <script type="text/javascript">
  79.     $('.pageQuestionFoo').click(function (e) {
  80.         e.preventDefault();
  81.         var page = $(this).data().page;
  82.         $.ajax({
  83.             url: "/QuestionFoo/Index",
  84.             dataType: 'html',
  85.             type: 'POST',
  86.             data: { sortOrder: null, currentFilter: null , searchString: $("[name=SearchString]").val(), page: page }
  87.         }).then(function (viewHtml) {
  88.             $('#viewHtmlTabClinica').html(viewHtml);
  89.         });
  90.     });
  91.  
  92.     $("#formSearchQuestionFoo").submit(function () {
  93.             $.ajax({
  94.                 url: "/QuestionFoo/Index",
  95.                 type: this.method,
  96.                 data: $(this).serialize(),
  97.                 success: function (data, status, xhr) {
  98.                     $('#viewHtmlTabClinica').html(data);
  99.                 },
  100.                 error: function (xhr, textStatus, error) {
  101.  
  102.                 }
  103.             })
  104.     });
  105.  
  106. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement