asp.net - MVC Items on paged ListView -
i'm using mvc , load data listview. works fine, here's view:
<% dim vardatasource new isam.entityisamrepository listviewdatos.datasource = vardatasource.listarcrucecertificadosprecancelados listviewdatos.databind() %> <asp:listview runat="server" id="listviewdatos"> <layouttemplate> <table id="listviewdatos" class="tablesorter" style="width:100%"> <thead> <tr> <th style="width:2%"> </th> <th style="width:6%" align="left"> <a href="#" style="text-decoration:none"><font color="black">pĆ³liza</font></a> </th> </tr> </thead> <tbody> <tr id="itemplaceholder" runat="server" /> </tbody> <tfoot> <tr id="pager" align="center"> <td colspan="7" style="border-right: solid 3px #7f7f7f;"> <asp:image id="image1" imageurl="~/images/first.png" cssclass="first" tooltip="inicio" runat="server" /> <asp:image id="image2" imageurl="~/images/prev.png" cssclass="prev" tooltip="anterior" runat="server" /> <input type="text" class="pagedisplay" readonly="readonly" style="width:100px; text-align:center" /> <asp:image id="image3" imageurl="~/images/next.png" cssclass="next" tooltip="siguiente" runat="server" /> <asp:image id="image4" imageurl="~/images/last.png" cssclass="last" tooltip="fin" runat="server" /> <select class="pagesize"> <option selected="selected" value="10">10</option> <option value="20">20</option> <option value="50">50</option> <option value="100">100</option> </select> </td> </tr> </tfoot> </table> </layouttemplate> <itemtemplate> <% static varcount long = 0 dim varid1 long = model(varcount).id1 dim varid2 long = model(varcount).id2 varcount = varcount + 1 %> <tr> <td style="border-width:medium"> <%=html.checkbox("chkcancel_" & val(varid1) & "_" & val(varid2), false, nothing)%> </td> <td> <%#eval("whatever")%> </td> </tr> </itemtemplate> </asp:listview> <p> <input type="submit" value="cancel" id="cmdcancel" onclick="if(!confirm('are sure?')) return false;" /> </p>
my problem on controller because need recover al checkboxes loaded listview request.form return checkboxes shown depending paging, mean, if i'm using paging of 10 items request.form gets 10 checkboxes, , said have 60 checkboxes (for example) , need 60 checkboxes using request.form or else (maybe trick :) ). here's controller:
function listmydata(byval varerr string) actionresult dim arrids(,) string = nothing dim varcount long = 0 each varitem in request.form if instr(varitem.tostring, "chkcancel") > 0 if request.form(varitem) = "true,false" redim preserve arrids(1, varcount) dim varcode 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
thanks.
i don't suggest mixing asp.net controls mvc. lot of them require state not maintained in mvc. i've had issues when use them.
i suggest use mvccontrib's grid or jquery's grid instead. both great , easy use. tend use mcvcontrib's because way works , don't need fancy client side processing.
Comments
Post a Comment