Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC Items on paged ListView
    primarykey
    data
    text
    <p>I'm using MVC and I load data into a ListView. Everything works fine, here's the view:</p> <pre><code>&lt;% Dim varDataSource As New iSAM.EntityiSAMRepository ListViewDatos.DataSource = varDataSource.ListarCruceCertificadosPrecancelados ListViewDatos.DataBind() %&gt; &lt;asp:ListView runat="server" ID="ListViewDatos"&gt; &lt;LayoutTemplate&gt; &lt;table id="ListViewDatos" class="tablesorter" style="width:100%"&gt; &lt;thead&gt; &lt;tr&gt; &lt;th style="width:2%"&gt; &lt;/th&gt; &lt;th style="width:6%" align="left"&gt; &lt;a href="#" style="text-decoration:none"&gt;&lt;font color="black"&gt;Póliza&lt;/font&gt;&lt;/a&gt; &lt;/th&gt; &lt;/tr&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr id="itemPlaceholder" runat="server" /&gt; &lt;/tbody&gt; &lt;tfoot&gt; &lt;tr id="pager" align="center"&gt; &lt;td colspan="7" style="border-right: solid 3px #7f7f7f;"&gt; &lt;asp:Image ID="Image1" ImageUrl="~/Images/first.png" CssClass="first" ToolTip="Inicio" runat="server" /&gt; &lt;asp:Image ID="Image2" ImageUrl="~/Images/prev.png" CssClass="prev" ToolTip="Anterior" runat="server" /&gt; &lt;input type="text" class="pagedisplay" readonly="readonly" style="width:100px; text-align:center" /&gt; &lt;asp:Image ID="Image3" ImageUrl="~/Images/next.png" CssClass="next" ToolTip="Siguiente" runat="server" /&gt; &lt;asp:Image ID="Image4" ImageUrl="~/Images/last.png" CssClass="last" ToolTip="Fin" runat="server" /&gt; &lt;select class="pagesize"&gt; &lt;option selected="selected" value="10"&gt;10&lt;/option&gt; &lt;option value="20"&gt;20&lt;/option&gt; &lt;option value="50"&gt;50&lt;/option&gt; &lt;option value="100"&gt;100&lt;/option&gt; &lt;/select&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tfoot&gt; &lt;/table&gt; &lt;/LayoutTemplate&gt; &lt;ItemTemplate&gt; &lt;% Static varCount As Long = 0 Dim varID1 As Long = Model(varCount).ID1 Dim varID2 As Long = Model(varCount).ID2 varCount = varCount + 1 %&gt; &lt;tr&gt; &lt;td style="border-width:medium"&gt; &lt;%=Html.CheckBox("chkCancel_" &amp; Val(varID1) &amp; "_" &amp; Val(varID2), False, Nothing)%&gt; &lt;/td&gt; &lt;td&gt; &lt;%#Eval("WhatEver")%&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/ItemTemplate&gt; &lt;/asp:ListView&gt; &lt;p&gt; &lt;input type="submit" value="Cancel" id="cmdCancel" onclick="if(!confirm('Are you sure?')) return false;" /&gt; &lt;/p&gt; </code></pre> <p>My problem is on the controller because I need to recover al Checkboxes loaded into ListView but the Request.Form only return the Checkboxes that are shown depending the paging, I mean, if I'm using paging of 10 items then Request.Form gets 10 checkboxes, and as I said I have 60 checkboxes (for example) and I need get the 60 checkboxes using Request.Form or something else (maybe a trick :) ). Here's the Controller:</p> <pre><code>Function ListMyData(ByVal varErr As String) As ActionResult Dim arrIDs(,) As String = Nothing Dim varcount As Long = 0 For Each varItem In Request.Form If InStr(varItem.ToString, "chkCancel") &gt; 0 Then If Request.Form(varItem) = "true,false" Then ReDim Preserve arrIDs(1, varCount) Dim varCode As String = Mid(varItem, InStr(varItem, "_") + 1) arrIDs(0, varCount) = Mid(varCode, 1, InStr(varCode, "_") - 1) arrIDs(1, varCount) = Mid(varCode, InStr(varCode, "_") + 1) varCount = varCount + 1 End If End If Next Return View() End Function </code></pre> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload