ListView Paging (VB.NET) RRS feed

  • Question

  • User-1546380551 posted


    I am using VB.NET 2012 in ASP.NET 4 and have added a ListView control together with a DataPager.

    In form load, I am populating things via a simple SELECT * FROM table and it populates fine.

    There is a textbox and a button on the page for filtering the results which uses

    "SELECT * FROM table WHERE field LIKE '" & TextBox1.Text.Trim() & "%'"

    or if the textbox is blank

    SELECT * FROM table

    The DataPager pagesize is set to 10 for testing purposes and pagedcontrolid is set to the listview

    When running the page it populates as it should do but having to click on the page links twice to change the page. If going from last page to first, or next to previous or vice-versa I get a list of empty field included in the results

    How can I open the data once for each client and allow them to search by filtering the results using VB.NET? Google linkers will be ignored

    Thanks in advance

    Sunday, December 2, 2012 12:37 PM

All replies

  • User3866881 posted




    As far as I see, I think you should re-write to PreRender to re-bind data content to your ListView.

    In the event, you should try to dynamically change the SQL statement to avoid the problem of TextBox's Text——if empty.

    For more you can download this sample:


    Monday, December 3, 2012 12:42 AM
  • User-1546380551 posted


    Thanks for the reply but it doesn't answer my question

    1) Filtering results in a Listview

    2) Never used 'prerender' in a different page but that works ok. Doesn't work with filtering

    Any code in VB.NET (NOT c#)? No point in converting code that doesn't answer my question, is there?

    Is there a website that has a VB.NET | ASP.NET forum where every answer is coded and not a link from Google?

    Monday, December 3, 2012 3:25 PM
  • User1957418580 posted

    Can you not use something like the sample here:  http://forums.asp.net/p/1601498/4081269.aspx.  Just make the SelectParameter a TextBox instead of a dropdown?

    Wednesday, December 26, 2012 1:33 PM