Paul Wilson's .NET Blog

Ramblings from the Creator of WilsonDotNet.com

  • VB.NET v2.0: Generics are Supported in VB Also

    Rob Chartier has created a really nice article titled Introducing .NET Generics.  Unfortunately, all of the sample code was written using C# -- just like every sneak peek on generics so far.  However, VB.NET will also fully support generics in .NET v2.0 (Whidbey), although not much has been stated about this.  Take a look at my VB.NET translations here -- you'll note that Of is the VB keyword used for generics, instead of using the <> syntax of C#. 

  • ASP.NET v2.0: Code-Beside Replaces Code-Behind

    I'm not at the PDC, but that can't stop me from talking about .NET v2.0 (Whidbey) as of today.  I'll try to do even better than the folks at the PDC and actually post some real details!  That's right, my goal this week is to post a brief article each day at ASPAlliance.com.  I'll also try to blog some other shorter details based on my experiences this last year.  So, here's the first article: ASP.NET v2.0: Code-Beside Replaces Code-Behind.  ASP.NET v2.0 replaces the Code-Behind code-separation technique with Code-Beside, which is designed to be an easier and less brittle method based on Partial Types.  (Note: I'm glad they did not call this Code-Behind v2.0, which was one of the early candidates.)

  • ASP.NET v2.0 (Whidbey) Articles on ASPNetPro.com

    I've been watching ASP.NET Pro Magazine start releasing articles on ASP.NET v2.0 (Whidbey) this week.  Technically they seem to be jumping the gun a little ahead of the PDC, but go ahead and read them if you subscribe.  So far they've released the following 3 articles, including mine on Master Pages:

  • Sorting and Paging Recordsets in SQL Server

    Here's a stored procedure that I use for sorting and paging large recordsets in SQL Server, as opposed to using the more common and terribly inefficient entire dataset approach in .NET.  It certainly doesn't matter much in the little classroom examples of a few hundred, or even thousands, of records, but working with larger recordsets with datasets is just bad.  This is even more true with ASP.NET, since the entire dataset is usually saved in viewstate, and since the web server is doing the processing for many users.  This stored procedure is certainly not the only way to do sorting and paging in SQL Server, but it is probably the most efficient, although proper indexing is still required to avoid table scans.  Note that this does not use temporary tables, which are convenient but not as optimal -- this also means you could modify this to be dynamic SQL for Access or other databases!  The parameters are the name of the table, the name of the primary key (necessary for the little bit of optimization included), the name of the sort field (or sort fields, with or without ASC/DESC), and the page size (number of records).  It also allows optional parameters for the page index (defaults to 1st page) and a query filter (defaults to null) so you can sort and page through filtered records only!  Note that it returns two recordsets -- the first is the results you expect, and the second recordset is a scalar with the number of total pages so you can better define the GUI pager for a grid.  This is relatively easy to integrate with the ASP.NET datagrid if you use custom paging and sorting, and it will minimize both your load on the server and the amount of data sent to the client's browser!  By the way, this code is just modified from some I found on the net, and there are certainly some minor optimizations that can be done, like using different sql for the first page.

  • Observations on my Google Search Rankings

    I've watched several others, usually with less common names, note their high rankings in Google, but I usually didn't stand out unless you included “ASP.NET“ in your search.  Until now -- a search on “Paul Wilson” on Google returns my blog as #5-6 now, as well as listing my WilsonDotNet.com site as #6-7 -- pretty good for a common name like “Paul Wilson”. Also, a search on “Wilson Blog” lists my blog as the #3-4, and a search on “Wilson .NET” (without the full “ASP.NET“) finally ranks me as #1 -- even ahead of Brad Wilson, aka DotNetGuy! The funny thing is that I have not been ranking quite as high lately on more specific searches, like page templates, master pages, and multiple forms, where I used to rank as high as #1. Another observation is that I don't see my articles on ASPAlliance.com show up as high in the searches anymore -- anyone else noticing poor rankings for their ASPAlliance articles? Finally, even though I've never really figured out what to do with MicrosoftArchitect.com, I also now have MasterPage.net, in honor of the upcoming ASP.NET v2.0 Master Pages.

  • Atlanta .NET User Group and DataGrid Girl

    I made it to last night's Atlanta .NET User Group meeting, as well as having dinner with Marcie (aka DataGrid Girl).  I don't get to these things very often -- I think this was my third total and second in the last year or so.  I was impressed with the size of the group (96) and the interaction that actually occurred amongst all us geeks.  Marcie did a great job -- I learned how to use the datagrid without enabling its viewstate!  Steven Heckler also gave a short talk on Regular Expressions which had to be the best explanation I've ever heard or seen.  There were also a good number of job announcements, which appeared to interest many attendees.  I was also pleasantly surprised at the number of people that knew who I was and wanted to talk to me -- and all I did was sit quietly in the back.  Anyhow, if last night was typical, then I would recommend attending if you are in Atlanta, although I still prefer going home to be with my family.

  • Are Many ThirdParty WebControls to Heavy?

    So what do you think of 3rd party webcontrols, like Infragistics, ComponentOne, Farpoint, etc?  We use Infragistics here at PRG, which is certainly a well-written set of controls.  The problem is that these things have to be so flexible to appeal to the largest number of customers that they are often way too heavy!  I was using their tree-view control (they call it WebNavigator) for a little while to easily display my data with dhtml behavior and it worked fine.  All the sudden when I had to add some more dynamic behavior in their client-side javascript I found that it took a couple of seconds or more to update!  My solution was to port my own rather simplistic tree-view control that I use on my site and the dynamic behavior is now instantaneous.  My code is certainly not as flexible as Infragistics, but it is incredibly fast due to its simplicity.  Similarly, while all these web-grids have cool features, they are also just too slow to use in anything but the simplest cases.  Their client-side sorting is way too slow for even medium sized resultsets, and once you turn to server-side you have now opened up the whole viewstate issue.  Instead, I end up doing custom paging and sorting through a stored procedure that only returns the page of data needed since this performs optimally.  But this leaves the grid being just another too-heavy pretty GUI control that really has nothing beyond a simple repeater.  So what does everyone else think about these super 3rd party webcontrols that have something for everyone?

  • One Month at New Job with PRG-Schultz

    I've been at my new job at PRG-Schultz for 5 weeks now, or a day or two past a month if you prefer.  Things are going very well, culminating in a very high profile demo yesterday in front of the CIO, VP, and other important folks.  This was an ASP.NET web application, with a SQL Server backend, that has a rather significant dynamic user interface.  Its also the first application based on a new GUI specification that was put together by a leader in the industry.  Of course, everything worked flawlessly -- I can't stand it when presentations are full of bugs so I make sure I do it right!  I suppose that's easier said than done, and I don't want to sound cocky, but I really do think that many people just don't think bugs are a big deal.  So lets get this straight if you are doing demos or presentations -- bugs are a big deal and you should work hard to avoid them.  This may mean you simply don't give into the impulse to add something new at the last minute, but its something that you must keep as a high priority no matter what.  OK, end of rant.