Last post Dec 26, 2012 01:33 PM by cts-mgraham
Dec 02, 2012 12:37 PM|crouchie2004|LINK
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
Dec 03, 2012 12:42 AM|Decker Dong - MSFT|LINK
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:
Dec 03, 2012 03:25 PM|crouchie2004|LINK
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?
Dec 26, 2012 01:33 PM|cts-mgraham|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?