Author Archives: Yuriy

IE Modal Dialog and ASP.NET PostBack solution

Internet Explorer has a well known proprietary modal dialog window that can be opened using showModalDialog DOM command. While it is not a good idea to use browser-specific functionality, for many it’s a convenient way to display a modal window and return result back to the parent.

Modal Dialog is designed to display data, accept user input and close window, returning the input back to the parent. It is not meant for postbacks, if you try initiating postback in Modal Dialog, all kinds of weird stuff could happen – from opening postback in a new window to JavaScript errors.

But there is an easy fix for that. If you include following line:

<base target="_self"></base>

inside of your page header in HTML source, e.g.:

<head>
    <title>My Page</title>
    <base target="_self"></base>
</head>

modal dialog will be able to successfully postback to itself.

TNX Text Links Ads: How to automatically fill all your ad spots (including pages with 0 PR) and other tricks

TNX Corp allows you to place static ad links on pages of your site, so you can earn some profit. Unfortunately if you leave it to TNX system, automatic rate at which links are sold and paced on your site could be very slow. You can add links to your pages manually via TNX site interface, but it is only allowed if your page Google PageRank is above 0. Also manual placement can be really inconvenient and you cannot place more than 4 ad links.

Fortunately there is a solution. Continue reading →

UltraWebGrid in OutlookGroupBy Mode: How to display custom aggregates (SUM, AVG, MIN, MAX) in GroupBy row

Last year I described a way to display accurate row count when grid in OutlookGroupBy mode has multiple sub-groups.

That solution requires custom counting function. Fortunately to display aggregates such as SUM, AVG, MIN and MAX UltraWebGrid has a built-in functionality in form of GroupByRowDescriptionMaskDefault property of DisplayLayout. It specifies the string to be displayed in every GroupBy row and can include following substitutes:

  • [caption] – will display GroupBy column header text
  • [value] – will display common to the group cell value
  • [count] – will display row count (does not work correctly with sub-groups)
  • [avg], [sum], [min], [max] – will display the aggregate for the column it’s grouped by
  • [avg:ColumnKey], [sum:ColumnKey], [min:ColumnKey], [max:ColumnKey] – will display the aggregate for any other column, where ColumnKey is the key of the column

With this in mind in just a few simple steps we can make UltraWebGrid to display something like this:


Continue reading →

Internet Explorer renders incorrect HTML if UserAgent string is too long

I’ve encountered a strange problem: 2 identical client machines (WinXP/IE7) were connecting to a website (running on IIS6, ASP.NET 1.1 and employing some Infragistics controls – UltraWebGrid, WebTab, WebMenu). One machine showed a perfectly rendered page, while the other displayed page with missing images and styles and JavaScript functions behaved weirdly. Also, closer examination of HTML source of the page revealed that Infragistics controls rendered very different HTML between 2 machines. Mystery.

The only difference between 2 browsers I found was UserAgent string (For quick way to check your user agent go to http://whatsmyuseragent.com/). Continue reading →

Session crossover in IE8

In IE6/7 if you open 2 independent browsers (not using “New Window” or “New Tab”) they do not share common session and you can login to, let’s say, a web mail account under 2 different users at the same time.
This is not the case with IE8. Using 2 browser (and seeing 2 “iexplore.exe” processes in task manager) if you try to login as 2 users – the second will take over the first. I guess it’s a new “feature” of the browser.
But IE8 gives you a way out, albeit not obvious one. In menu, you can select File -> New Session. This will open a new browser window with independent session.

View real HTML source of a page

All browsers support “View page source” feature. But what it displays is source of the page as it was originally rendered by the server. In today’s Web 2.0 world page content can change a thousand times after that. Client-side script, user input, AJAX calls can contribute to page update.

But one line of JavaScript code can show you a real up-to date page source. Type following in your browser address bar:

javascript:void prompt('HTML Source',document.documentElement.innerHTML)

Continue reading →