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
Please click 'Mark as Answer' if my reply helped
Homepage | YouTube Channel | Post code, not links
crouchie2004
Member
497 Points
306 Posts
ListView Paging (VB.NET)
Dec 02, 2012 04:37 PM|LINK
Hi,
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
or if the textbox is blank
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
Homepage | YouTube Channel | Post code,
not linksDecker Dong ...
All-Star
118619 Points
18779 Posts
Re: ListView Paging (VB.NET)
Dec 03, 2012 04:42 AM|LINK
Hello,
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:
http://www.codeproject.com/Articles/24065/Paging-ListView-With-DataPager
crouchie2004
Member
497 Points
306 Posts
Re: ListView Paging (VB.NET)
Dec 03, 2012 07:25 PM|LINK
Hi,
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?
Homepage | YouTube Channel | Post code,
not linkscts-mgraham
Contributor
3318 Points
642 Posts
Microsoft
Re: ListView Paging (VB.NET)
Dec 26, 2012 05:33 PM|LINK
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?