I want to list data with repeater from database on a server. There are nearly 5000 data in the database. When listing this data with repeater, the page loads a bit late. How can I quickly list data?
Thanks..
Simple: don't try to display so much data in one list.
No user is going to scroll through 5000+ records to find the one they want.
Use paging, and provide options for the user to filter the returned data.
NB: Whilst you can add paging support to the Repeater control, it's not supported by default. You would probably have better luck using the ListView control instead, combined with a DataPager control.
Related
I have rapid incoming data (which are basically rows of a tabular data set). As i receive these rows, I merge/upsert them into the data cache. The data has to be shown on a WPF control (an item control).
The problem :
The data is not directly bound to the user control. A series of filter and grouping/aggregation (done using LINQ) is applied on the data before it is shown to the data. Thus what the user sees on the control can drastically change (say he changes the grouping, then all the rows will change).
This is what I am doing as of now :
As the data is coming in VERY rapidly, a thread is picking up the data every 2 seconds, applying the filter and then grouping the data and binding the data set to the wpf item control.
This is definitely not good as a new data table is being set as the datasource every 2 seconds. The application becomes laggy after some time.
What will be the best approach for me to solve this problem ? Thanks.
I'd say the best way to approach this would be to create a view source and bind the display element directly to that - that way you've got the grouping and filtering systems using the built in stuff.
I'd also then look into virtualisation and optimisation which will help with showing a lot of data.
As a more general note, I'd say explore whether you really need all that data to be displayed and at that frequency; it might be a better user experience (and easier on the machine) to aggregate the data and just surface pertinent details, that the user can then drill-down into further as required.
I have worked with both the controls for simple application development . Both almost do the same functionality. What is the difference between them ?
There is a table here that compares the data bound server controls:
http://weblogs.asp.net/anasghanem/archive/2008/09/06/comparing-listview-with-gridview-datalist-and-repeater.aspx
GridView always renders as a grid. Repeater allows you to create your own template layout. For instance, you can put things in divs. GridView also has a much more rich object model, while repeater is rather simplistic.
Yes, you can achieve similar results with both, but they are nowhere near the same thing.
Both these controls are Data-Bound Web Server control.
GridView : It displays data as a table and has ability to preform sort, paging,edit and delete a record.
Repeater : has fewer templates then GridView. It renders a read-only list from the datasource.
I want to make a control that show list of bounded data like in grid view but I want to be able to insert new record from the same control
what is the best asp.net control I can use to do that (GridView , FormView or DetailsView)? and why?
Thanks in Advance
You can do that with all three. If you want to know how, there are some good tutorials on the official ASP.NET website, here.
The choice between them is a formatting/layout decision. A GridView produces a table, showing multiple records, while a DetailsView shows one at a time. A FormView lets you display the data however you want, but required much more effort, since you have to provide the HTML.
My current situation is to display an unknown number of Plantypes and within those Plantypes display a list of Participants(also unknown number), the participants have a textbox and a dropdown that is editable (you can't edit the individual rows, there is one update that does a bit of validation then updates all rows.)
I currently have a gridview nested withing a repeater, the repeater displays the Plan in a label and OnItemDataBound I call a method to populate the gridviews. It looks great, but I can't figure out how to save all the data at once. I'm not opposed to handling this a different way, as in loose the gridview and or repeater, if someone has a better idea.
This is C# and framework 2.0...there is no sorting or paging on the gridviews...just some links and the fields to update.
thanks in advance,
Padawan
HTTP is stateless. Since a user physically can only update one record at a time you should implement some way to save as the user goes. This can be a simple as having a row focus and row blur events and do the saves using AJAX on blur(unfocus). Maybe make is modal as they edit so they cannot leave the page without saving.
C#: What is the best way to implement a 'filter' mechanism for ListView Items?
I want to filter out some listview items from view in 'details' mode where it contains rows and columns. What would be the best option to create such a mechanism where I could rapidly remove the items in question from view, leaving the others intact, and putting them back into the listview when there is no more need to filter out listview items? Should I remove/copy them to a List and just and add them back when done or would there be a better method of doing this more effeciently? The listview will be handeling about 100-500 items.
If you are working with a databound control you will have this facility within the binding framework.
If not, I would probably store all the items for the list separately and populate the control in full each time, based on any contextual requirements such as filtering. The code to iterate through the list and move items not required at present is probably unnecessarily complicated. A full repopulate each time will be easier and won't differ much in terms of computational expense.
This behavior is built in to BindingSources using DataSets in .Net 2.0.
For .Net 3.0+, you can use LINQ.