Jeff's SQL Server Blog

Random Thoughts & Cartesian Products with Microsoft SQL Server
posts - 155, comments - 2679, trackbacks - 64

My Links



Welcome to my weblog. My name is Jeff Smith, I am software developer in Boston, MA and I was recently named a 2009 SQL Server MVP. Check in frequently for tips, tricks, commentary and ideas on SQL Server and .NET programming.



Post Categories





ASP.NET 1.1 and 2.0 are covered here. A great improvement from ASP, and a natural fit with SQL Server of course.
Minimize a DropDownList's ViewState

Let's say you have a very large DropDownList with lots of values and text.  We need to maintain ViewState in this DropDownList so that we can retrieve the selected value on a post back.   Of course, this means that now the ViewState contains the data for every single value in the list, both values and text included.   Even though the page itself may be fairly simple and lightweight, the result of having this simple DropDownList on the page is that the page size is quite large and the amount of data passed back and forth on a postback is very...

posted @ Thursday, April 17, 2008 12:21 PM | Feedback (8) | Filed Under [ .NET (C# / VB) ASP.NET ]

Splitting a single DataTable into Parent/Child DataTables for Hierarchical Processing (e.g., nested ASP.NET Repeater controls)

In ASP.NET, we often would like to output "grouped" data on our web pages, like this: Customer Product     Sales -------- ----------  ----- ABC Foundation          Product 1   $200          Product 2   $437          Product 3   $523         The XLZ Company          Product 1   $240          Product 2   $892          Product 3   $395    The easiest way to do this is with nested Repeater controls; one for the outer group (Customers, this case), and within that Repeater's ItemTemplate we'd have another Repeater control for the details (Products).  To use nested repeaters, you would return two separate result sets from SQL:  A "Customers" result set,...

posted @ Friday, November 02, 2007 12:16 PM | Feedback (0) | Filed Under [ .NET (C# / VB) ASP.NET Code Library - C# / VB.NET ]

Some HTML / ASP.NET Thoughts ...

On a particular real estate website, we have a "Property Summary" section that contains each property's name, the address, a phone number (if it exists), and a contact email address (if it exists). The information is data bound to properties in the page's code-behind, and the ASP.NET code basically looks like this: <div>   <%# Property Name%>   <%# AddressLine1 %>   <%# AddressLine2 %>   <%# AddressLine3 %>   <%# CityStateZIP %>   <%# Phone %>   <%# Email %> </div> Because lots of these elements are optional, all of these properties have all been written to work like this in the code-behind: Protected Readonly Property AddressLine1 as String   Get      If...

posted @ Wednesday, October 17, 2007 11:13 AM | Feedback (2) | Filed Under [ ASP.NET ]

Creating CSV strings in SQL: Should Concatenation and Formatting Be Done at the Database Layer?

A question I see very often in the SQLTeam forums is how to return data in a summarized form by concatenating a list of values into a single CSV column. This can be done fairly easily in T-SQL, but as the formatting and concatenation requirements becomes more elaborate, be sure to ask yourself: Am I forcing presentation code into the database layer? read more...

posted @ Tuesday, October 09, 2007 3:02 PM | Feedback (19) | Filed Under [ T-SQL .NET (C# / VB) Efficiency Report Writing ASP.NET Joins/Relations ]

Using LINQ with SQL (link)

There's a great series of posts over at Scott Guthrie's Blog covering LINQ, a new feature in the upcoming version of Visual Studio ("Orcas"). Check it out; I have not had a chance to play around with it yet, but it certainly looks very interesting. The articles are very well done and explain the concept very clearly with lots of examples.

posted @ Friday, July 13, 2007 4:27 PM | Feedback (1) | Filed Under [ ASP.NET Links ]

ASP.NET 1.1 -- Appsettings in Web.config

It's great to be able to put settings in the Web.Config file for my ASP.NET projects. The problem for me, though, is that when I use System.Configuration.ConfigurationSettings.AppSettings(name) to return a setting that doesn't exist in the file ...

read more

posted @ Wednesday, March 28, 2007 12:09 PM | Feedback (12) | Filed Under [ .NET (C# / VB) ASP.NET Code Library - ASP.NET ]

Minimizing the ViewState for an ASP.NET 1.1 DataGrid

By default, the ViewState for ASP.NET DataGrids can be quite large, as it normally stores enough information to recreate the grid completely after a postback. Often, I have found that I need the grid to display a list of items with only paging, sorting, and some buttons that let you delete or edit (via another page) individual items.


posted @ Tuesday, July 11, 2006 10:22 PM | Feedback (5) | Filed Under [ .NET (C# / VB) ASP.NET Code Library - ASP.NET ]

Powered by:
Powered By Subtext Powered By ASP.NET