ASP.NET Repeater Paging/Sorting - asp.net

So what's the real story on how to do this. All of the examples I find use Default Paging (HOW does anybody find that acceptable???) but I want to use custom paging. I can't use a GridView because I need more flexibility. The examples I see all use the PagedDataSource class but I can't find one that uses Custom Paging. Am I doomed to have to roll my own paging/sorting solution to avoid the bloatware of the other build-in methods?

A simple repeater used for paging where a few page numbers are rendered horizontally is pretty easy to code up and re-use.

I think most people who need this much custom work will reach for a third-party control toolkit, like Telerik, DevExpress, Infragistics, or ComponentOne.
If you want to do it once you'll probably want to do it again, and therefore it's worthwhile to have a quality, re-usable, generic, tested solution available.

Related

Ajax enabled sorting and paging on grid in ASP.NET 3.5

Is there any good solution for ajax enabled Grid with pageing and sorting which only brings the required data from database? I mean it should only bring the data from the database which is to be displayed on the particular page number of the grid.
I looked at this. It looks good. But I just thought if anyone has created something better using Google's or Yahoo's javascript library or using any good features of asp.net 3.5.
I'm replying my own question.
I found Ajax Data Controls as updated version of what I had specified in my question. Still I will not mark it as answer and will wait for better answer.
If you are using a datasource control (SqlDataSource, LinqDataSource etc) this would be done automatically (retrieving only the current page of data). To make paging and sorting ajax-enabled wrap the grid inside an UpdatePanel control.
I used devexpress grid. It has sorting, grouping and paging. It is not perfect one but looks nice and easy to use.

asp.net repeaters. To use or not to use

We are currently using a repeater to display input fields, drop downs, check boxes, and calendar items on each row. The desired functionality is to allow the user to add up to 10(this could potentially change by web config) items (each row).
Is it appropriate to list these out in a repeater or am I going about this the wrong way? What should I be using? Is there something lighter?
asp.net repeaters. To use or not to use
USE!
A repeater is crazy lightweight and perfect for this. Use it all over the place!
Slightly more in-depth answer:
If you are having some performance problems that are causing you to rethink your code, start by profiling. It will shed light on where the real problems are right away, and I guarantee they won't be from using a repeater. The amount of time your application spends in repeater code is almost certainly not even worth measuring.
If you're not having performance problems, why are you asking? :) Go build something or have a coffee and leave well enough alone. Don't optimize until it's clear you need optimization.
Repeater is about as light weight as it gets. If you have a sound code base that supports iteratively showing fields with a Repeater, then that's basically as good as it gets.
a Repeater is about the lightest thing you can use; it only displays what you tell it to. I'd say it's quite acceptable.
ASP.NET's Repeater control is the lightest data control, if you want to get rid of it and using ASP.NET v 3.5 then I would recommend you to use Listview control instead.
Hope this works!

Are DetailsView /FormView enough rich for Edit and Insert?

I'm wondering are DetailsView/FormView and ObjectDataSource have enough capability for Inserting/Editing your records or not ?
Or better ask you Do you prefer use them or make your form by your own ?
Because some times it's not easy to use them for complicated task , On the other hand when you have a lot of fields , that's over killing make your form by your own.
No doubt you can use asp.net detailsview and formsview to edit, insert, display data. This makes it easier and faster to play around your data, if you are handy with it. Otherwise you may stumble with some typical odds, of which almost all are answered and you can find them over Internet. Conclusion: Once you get with formsview, detailsview they will be your favourite tools! That is what Microsoft wants of developers.
Still there are some points to remember: if you have forms with lots of controls and you need them interact with each other, you need to consider playing around the straight ways of formview, detailsview. In such case, you would feel very easy if you had created your own UI with necessary controls.
Yes, they do. Each of these has an insert/edit template. You can make them work, and they work fine. Have used them in my own applications. Complicated tasks, formview should be able to handle because you have full control over the UI and layout.
If you have a large form, detailsview allows you to specify fields and allows the control to do the work (you simply specify the data and detailsview handles the form), but of course with a custom UI the formview is the way to go, and yes it can be tedious to have to create large forms... but it's something we developers must do, either find or create a form builder control or create the UI markup ourselves.

Is the ASP.net GridView control a clever design?

I have been using gridview since a long time. I have a "cant live with you and cant live without you" relationship with it.
The idea of Edits, inserts and deletes from within the grid is great but having to do something like
var sometext = ((TextBox)editRow.FindControl("tbSomeText")).Text;
just seems very un-clever to me. Has anyone comeup with a solution or knows (resource) where you perform CRUD operations + paging and sorting from within the grid and dont have to write ugly code (like above). I am not looking for solutions using DataSource objects since I am not its biggest fan. I will be happy if someone can tell me how to live without GridView in asp.net.
I understand there are AJAX implementations but I am looking for something completely serverside.
I always use repeater control instead of others. Because i feel free with it. I build up the html by myself and can do a lot of thing like paging sorting. But of course you need more effort for the repeater for these kind of functionality.
For CRUD operations, i use jQuery thickbox (modal pop up and iframe).
My choice is Repeater
If you are trying to make a basic CRUD website, have a look at ASP.NET 3.5 Dynamic Data which is a great website to add as a pure data access website with CRUD ability. However, its extremely customizable.
Gridview has its advantages and I used to love it in the .Net 2.0 times about two/three years ago. However, since then there are much better .Net 3.5 controls (like ListView) that give you a better ability to customize content. I'd also have a look at many third party grid tools from (Telerik, Infragistics, ComponentArt, ComponentOne, DevExpress) that have a lot more capability than the inbuilt gridview control.
I despise it, every time I've used it or seen another developer use it, they almost always end up going with something else. I've never once heard any developer I've worked with say "I love GridView".
You can hook up the GridView and DetailsView and use basic SQL scripting or complex business objects along with DetailsView.
I have found DetailsView to be very useful.

ASP.net AJAX Search

I am looking for an example of using ASP.net AJAX to show a 'live' filtering of a repeater control based on what is being typed into a textbox. I have seen stuff using the Web Client Software Factory but am more interested in something that doesn't require an additional library.
The asp.net ajax control toolkit has one here.
If you don't like that one, searching google for "Ajax Autocomplete" gives lots of decent looking results, unless I am mistaking what it is you want to do.
I think you're a little confused as to what AJAX entails. If you want the filtering to interface with the server control's datasource, then it would not by definition be AJAX.
Live filtering a databound control the way you want is ill-advised, I think. For each iteration you'd have to re-bind the control, which would create a tremendous amount of overhead.
You'll need to find a way to do this client-side, with javascript. It could simply hide items within the repeater-created markup as they are filtered out, although how exactly this would be accomplished depends entirely on what html you're generating with the repeater.

Resources