Yearly Archives: 2009

Correcting “ASP.NET AJAX client-side framework failed to load” error

If you’re trying to use ASP.NET AJAX features (like Script Manager or Update Panel) in your ASP.NET 3.x website and getting “ASP.NET AJAX client-side framework failed to load” error, chances are your Web.config file is missing required sections. Fastest way to correct this is to create a new ASP.NET website in Visual Studio (you can delete it afterwards) and copy missing sections from the new web.config to the one in your web site.

Update: As churawut pointed out missing .AXD mapping in IIS configuration is another common source of this error (often this is done as security hardening on the IIS).  I encountered it while researching missing images in ASP.NET charts, and found out that underlying reason was missing/corrupt .AXD mapping in IIS.

Select specific groups using DENSE_RANK

Imagine after running a query like this:

SELECT ContactName, Country FROM Customers ORDER BY Country

on Northwind database and getting following result:

ContactName           Country
Patricio Simpson      Argentina
Yvonne Moncada        Argentina
Sergio Gutiérrez      Argentina
Georg Pipps           Austria
Roland Mendel         Austria
Catherine Dewey       Belgium
Pascale Cartrain      Belgium
Anabela Domingues     Brazil
Paula Parente         Brazil
Bernardo Batista      Brazil
Lúcia Carvalho        Brazil
Janete Limeira        Brazil
Aria Cruz             Brazil
André Fonseca         Brazil
Mario Pontes          Brazil
Pedro Afonso          Brazil
Elizabeth Lincoln     Canada
Jean Fresnière        Canada
Yoshi Tannamuri       Canada
...

You’re asked to retreive only the 2nd and the 5th group of contacts. How do you do it? Continue reading →

T-SQL String Aggregate in SQL Server

T-SQL dialect of SQL doesn’t have aggregate functions for strings, but there is an easy workaround using magic of XML.

Consider Employees table of the Northwind database. When I run following query:

SELECT Country, FirstName FROM Employees ORDER BY Country, FirstName

I get following result:

Country FirstName
UK      Anne
UK      Michael
UK      Robert
UK      Steven
USA     Andrew
USA     Janet
USA     Laura
USA     Margaret
USA     Nancy

Now I want to combine first names into comma separated strings grouped by country. Continue reading →

Global Chart Type for Dundas Chart Control

      Dundas Charts for .NET has many cool features like async callbacks, AJAX scroll and zoom, plenty of chart types and great visuals, but in some cases some of those features could turn out to be more of a burden than useful. One example – the ability to set chart type for each individual series of a chart. This offers great flexibility in building combination charts (you can display column and line on the same chart to reflect different series’ data), but you’re losing the Infragistics simplicity of just setting the chart type and binding chart to data without worrying about appearance of each individual series.
      This is especially inconvinient if you load chart appearance (including series appearance and chart type) from an external template. If you want to use chart type from the template, but feed it your own data – you’re stuck.  But there is a solution. Continue reading →

ASP.NET accessing session variables in class modules

Sessions are a great way to share variable across your entire application, but they’re not accessable directly in class modules since they’re outside of page scope. So if you try something like Session(“VariableName”) = value  inside of your class, you will get an error.

Fortunately there is a way.  Thru HttpContext.Current notation available such common properties as Session, Server, Application, Cache. So to access your session variable inside a class just use HttpContext.Current.Session(“VariableName”) = value

Fixing WordPress 2.7 broken permalinks

When I moved this blog from former IIS to this Apache hosting I wanted to enable “pretty” permalink structure /year/month/day/topic, knowing that mod-rewrite was installed and active. But when I did that – every link resulted in 404 “Not Found” error. Trying to find solution I in WordPress support forums or even googling it was to no avail.
Finally I realised that when WordPress was enabling new link structure, for some reason it wasn’t writting rewrite rules into .htacess file. So, I put them there manually:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . / [L]

And it worked.

Ultrawebgrid: Highlight row on MouseOver

To highlight row in Infragistics Ultrawebgrid on mouse over event you just need to follow 4 simple steps:

First, define a class to be used for highlighting, for example:

<style type=”text/css”>.over { BACKGROUND-COLOR: lightcyan }</style>

Second, set mouse over/out handler (either in source or thru designer):

<ClientSideEvents MouseOutHandler=”MouseOutHandler” MouseOverHandler=”MouseOverHandler” />

Third, implement event handlers:

/* highlight row on mouse over */
function
MouseOverHandler(gridName, id, objectType){
     var
ohRow = igtbl_getRowById(id)
      if (ohRow) ohRow.Element.className =
“over”
}

/* return row backcolor on mouse out */
function
MouseOutHandler(gridName, id, objectType){
     var
ohRow = igtbl_getRowById(id)
      if (ohRow) ohRow.Element.className =
“”
}

Fourth (and this is important, see why) set background of the row style to inherit:

<RowStyleDefault BackColor=”Window” BorderColor=”Silver”
     
 BorderStyle=”Solid” BorderWidth=”1px”
       
CustomRules=”background-color:inherit” Cursor=”Default”> …

Now you’re all set! The row will be highlighted on mouse over.

Windows 7: First Impressions

I’ve been using Windows 7 Release Candidate for about a week and so far like it very much. Out of all Oses I’ve ever installed it was the first one to detect my home wireless network during setup. Oh and under Windows 7 for the first time Intel Wireless N card achieved full 300Mbps speed even though it is connected to a Dlink router (all manufacturers warn that to achieve full N speed you have to have both client and access point of the same brand). And overall it has a very light, easy feeling, I actually enjoy sitting behind Aero desktop. And only now in comparison, I understand what a bloated pressure was imposed by Vista behemoth.

No compatibility issues, all software and games work perfectly (by the way I am using 64-bit version of Windows 7). It looks like Microsoft did good this time. Apparently Windows releases follow the same law as Star Trek movies – every odd one sucks, every even one is good:

  • Windows 95 – weak start
  • Windows 98 – ok
  • Windows Me – sucked big time
  • Windows XP – pretty good
  • Windows Vista – big flop
  • Windows 7 – … so far so good

So hopefully Windows 7 will be a hit, as well as the new Star Trek movie (which I still have to see).