Recommendations for Implementing Complex ASP.NET Grid with AJAX Functionality - asp.net

I'm considering going at this myself because my requirements are particular and highly customized:
The grid is bound to a
collection of complicated objects,
each of which may contain child and
grandchild objects. Depending on
data and context, the template'd
cells vary from TextBoxes to
ComboBoxes to Calendars to a
combination of controls.
TextBox cells have Google-style
auto-complete functionality. Also
each TextBox cell can expand into a
small TreeView pane that allows
hierarchy-navigating selection of a
value should auto-complete be
insufficient.
Values from other controls can be drag-and-dropped into cells.
Columns are re-sizable and re-orderable. Clicking their headers
sorts data.
All of the above is AJAX /
client-side / Web 2.0 of course.
Has anyone built anything similar from scratch? Or used an effective tool to accomplish this goal? How well would Telerik meet my specs? Is it right to have the hunch that something this specific is best done by taking a Microsoft GridView and extending it myself?
Thanks for your two cents.

If you have a SQL Server-based application, you could consider using ASP.NET Dynamic Data as a starting point. I have used it for the first time a few weeks ago and found it quire useful. It provides a lot of functionality, but you still can customise nearly everything. However, seeing your requirements you probably will have to customise a lot of things.

If you intend to use Telerik based on the specification you put forth, browse the online demos of their Ajax grid first. Most of the features are supported I think (some by integrating other Telerik controls in the grid like RadComboBox with auto-complete), for the rest you should count on your custom coding.

Related

What's the official Microsoft way to track counts of dynamic controls to be reconstructed upon Postback?

When creating dynamic controls based on a data source of arbitrary and changing size, what is the official way to track exactly how many controls need to be rebuilt into the page's control collection after a Postback operation (i.e. on the server side during the ASP.NET page event lifecycle) specifically the point at which dynamic controls are supposed to be rebuilt? Where is the arity stored for retrieval and reconstruction usage?
By "official" I mean the Microsoft way of doing it. There exist hacks like Session storage, etc but I want to know the bonafide or at least Microsoft-recommended way. I've been unable to find a documentation page stating this information. Usually code samples work with a set of dynamic controls of known numbers. It's as if doing otherwise would be tougher.
Update: I'm not inquiring about user controls or static expression of declarative controls, but instead about dynamically injecting controls completely from code-behind, whether they be mine, 3rd-party or built-in ASP.NET controls.
This greatly depends on the problem at hand, and the type of controls you're recreating. Are they all simple text boxes or various different complex custom user controls. the main thing here is: if you want your dynamic control to regain state after a post-back, you have to re-create it in the Init phase of a page life-cycle.
Anyway. There's nothing like a Microsoft way or Microsoft recommended way basically. When you're dynamically adding several simple controls of the same type a hidden field with a count would do the trick, but when you have several complex controls other ways would have to be used. You could still hidden fields and save control's full type strings in them (ie. System.Web.UI.WebControls.TextBox) and re-instantiate them. But think of an even more complex example of putting various controls on different parts in the page... And initializing them to a specific state. That would be a bit more challenging. Hence no Microsoft way... The recommended way is to recreate in Init phase. And that's it.
Everything can be solved, but sometimes one took a wrong direction in the UI and things could be done easier using a different approach.
Additional explanation
This state-full technique of ViewState that Asp.net uses is considered the worse culprit with web developers in general. That's why Asp.net MVC developers think the new framework is bliss since its much more suited to the state-less HTTP protocol. Me being one of them. :D

Web Grid, Client side Binding VS. Server side HTML generation

I'm working on replacing an existing web grid in an ASP.NET web application, with a new implementation. The existing grid is powerful, but not flexible enough. It also brings with it all kind of frameworks we don't like to have on our web pages.
While looking into existing options I noticed I can break the available solutions into two main approaches. The older approach is represented best by the ASP.NET GridView. This is a classic ASP.NET control that generates the needed HTML on the server, based on a given set of data. The newer approach is depending on client side rendering, mainly with jQuery. A good example would be jqGrid. Only the data is sent to the client (Usually with JSON or XML)
In the GridView case, if I want an AJAX behavior, I would have to implement it with something like an update panel.
Is there a definitive choice I should make?
Is there a good chance of achieving the same snappy behavior I get with jqGrid (even with many records), with server side rendered controls?
Is there some hybrid implementation incorporating both approaches?
There is no definitive choice you should make, but it's worth noting
that changing to client-side AJAX controls is a pretty big paradigm
shift that will require you to rethink how you do nearly everything
with the grid.
Going half-way (by using a server-side control such as GridView
in an UpdatePanel) will likely improve the user experience, since
the page will still be visible and responsive while it's updating. But
the UpdatePanel-style is still clunky compared to the new client-only
grids, because this technique sends all the page's form data when it posts back
(including all that ViewState in the GridView, if ViewState is turned
on). One brief note of caution: GridView is not compatible with
UpdatePanel when GridView.EnableSortingAndPagingCallbacks is set to true.
I haven't used any of they hybrid implementations (such as Coolite's Ext wrappers for .NET), but they are out there. There was at least one good SO discussion about this topic and the different grids available here.
I am also evaluating jgGrid vs. Gridview. I am just interested in the performance and efficiency of the grid. Even though jqGrid has a bit learning curve, I can invest some time in learning if it can provide great improvement in performance when compared to gridview. Can any expert throw more light on this topic?. Thank you very much.

To build, or not to build a kind of Gridview control from scrach?

I want to show some results in a GridView kind of way.
But for each page I want to show 3 "inner Repeaters" showing data from 1-10,11 20 and 21-30 respectively. You can see this in the folowing image.
alt text http://img196.imageshack.us/img196/1285/examplesv.jpg
My question is, is this easier to buid with only one gridView, and several Item Templates,
OR should I buid a new user control from strach?
I'd recommend building your own user control from scratch for this. Even when used for its intended purpose (displaying table-based data), working with the GridView is like having a root canal.
In general, when it comes to non-standard UI elements (like what you're doing), you will probably end up spending much more time trying to hammer an existing control into the shape you need than you would just writing your own from the ground up.
Do you need all the functionality of a gridview, or are you just rendering and paging data? If not, then perhaps the Gridview is not the appropriate control to build from.
Also, be sure to look into the new ListView and datapager controls.
http://www.west-wind.com/WebLog/posts/127340.aspx
I'd have a close look at ExtJS's Grid. It's impressive looking and has a lot of features you need. The JS file generated may be a bit large though so maybe build your own if you're putting this on the internets.

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.

How to choose a databindable grid control

I recently started working with ASP.NET 3.5, having previously worked with C# and WinForms (mostly .NET 1.1) for about 6 years.
My head spins every time I need allow the user to view, add/remove or edit a list of items. This is due to the similarities, and differences, of the following controls
DataGrid
GridView
ListView
DataList
Can anyone point me in the right direction of a nice list that does a side-by-side comparison of these controls?
Which is your "favourite", or your favourite for any particular scenarios?
Short answer, with the exception of listview, they all suck ;-) Depending on your particular situation, you probably want to look into a more full featured grid by a third party, such as telerik or devexpress.
long answer, it depends on what you want to be doing.
DataGrid and DataList are mostly there for backwards compatibility. GridView and DataList are better then the older versions.
GridView is for when you want to display a grid of data. It gives you CRUD (create read update delete) operations mostly for free, and also has paging and sorting mostly for free (depending on what kind of data source you are using)
DataList is for when you want a more free form list of values.
ListView (and datapager) is our brand spanking new asp 3.5 control, and is even more free form then DataList. It lets you set up a layout template with whatever you like, and an item template which will repeat for each item in the list. You stick a container element (div/panel/placeholder) into the layout template, then tell the control which one it is, and it will repeat the item template into it for each item on the list.
You can also point a DataPager control at it, and get paging mostly for free.
Depending on what kind of site you are doing, using the built in data controls (other then repeater and listview) may end up painting you into a corner, as they have alot more overhead then are needed. If it is a small one off project, that isn't much of an issue. If its a big project where perf will be an issue, I would recommend again checking out third party controls.

Resources