[This probably isn't of interest to most people, but hopefully the googlebots will find it and maybe I'll help someone else in the same position. Feel free to skip over this post and check back later :-)]

[No, seriously....unless you're doing some programming, it's probably best just to skip it!]

This post has been in the making for a long time…well, the last couple of weeks anyway. I was given a project at work where I needed to make a web screen to display data from new records system database. After toiling away with the included tools (KB_SQL and STAR, by the way, with a ghetto-assed ODBC driver), I got the chance to do some web work again. Even better, I got to do it using Visual Studio 2005 and ASP.NET 2.0, which I am excited to learn. On top of all that, this was an opportunity to use Atlas, too. Now I could finally get some hands-on work with the new Visual Studio, and use the AJAX enabled stuff, too. Woohoo!

The basic requirements were to have a search screen, and to bind those results to a grid. The only real “catch” to the whole thing was Mangement wanted to be able to sort on multiple columns, which proves to be a royal pain in the ass for the most part, no matter what I seem to be working on. Luckily, ASP.NET’s GridView control fit the bill nicely, and it even has built-in sorting capabilities. Plus, as luck would have it, I found an article that tells how to extend the GridView to do multiple column sorts!

I went through the tutorial, and for the most part, it worked like a charm. Well, it worked perfectly, but trying to get it to work with Atlas was a pain. It turns out my problem was that some control on your form needs to be Autopostback-enabled, or else the sorting won’t work. It took an obscure reference on some forum for it to work. But once it did - it’s awesome!

The search works, things are returned to a dataset, which is then bound to the GridView. The user can sort on multiple columns just by clicking on each one successively, and since it’s working with Atlas, there are no page refreshes at all. So where’s the problem?

The Powers That Be were demoed the project today. Two of the three were completely impressed, which is good. The third, which happens to be my boss’ boss, complains that the sorts take too long. :-/ Dang it. Admittedly, when you click on a column, there is a 1-2 second pause while the page requeries the database and then presents the data. It’s noticable, but I didn’t think it was an issue, especially since the whole thing works together really slick-like and all.

Sooooo, he wants me to figure out how to make it sort faster, and I’m at a loss right now of what to do. What’s taking so long is requerying the database, and that’s probably slow because of the stupid ODBC driver. So to make it faster, I have to load the results into memory or something, and keep them there. The problem with that is 1)large results being stored in memory (especially if many people are using the page at the same time) is bad, 2)if it’s not refreshing from the database, the data could be old, and then people would need a “refresh” button, which they won’t like either, and 3)databases are better designed to handle sorting, they should let them do the work!

To make it work, I’m not sure how much of what I have done I’ll be able to keep. The GridView is already doing most of the work, the tutorial I mentioned just extends that. And I’m not familiar enough with .NET yet to hack into it too much, not to mention keeping things clean and elegant. It just pains me to have to reinvent the wheel just because someone doesn’t like a short pause. He said he wants it like our other multi-sort pages - except the other one is in classic ASP with everything passed in the querystring (aarrrgghhh), and IT MAKES A TRIP TO THE DATABASE ON EVERY SORT TOO!!! So I pretty much needed to come up with a new solution anyway.

Sigh….I can’t win, and I’m rambling. We’ll see what I can come up with tomorrow…it just pains me to have to throw out a perfectly good solution that’s technically better just for display purposes. It doesn’t help that I feel like I don’t know what the hell I’m doing - I’m learning so much as I go, which is great (I really am learning a lot), but it’s hard to justify why I do some things because that’s the way I read a tutorial or article how to do them. I’m not quite at the point of full understanding of everything yet. Ah well, such is life.

2 Responses to “ASP.NET 2.0 GridView rants and raves (2)”

  1. Hi there, Can you send me the code of this atlas enabled GridView

  2. Thanks in advance

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>