Yearly Archives: 2010

LightGray in IE6

IE6 just won’t die. I know, continue to support it is a bad idea, but unfortunately many developers have no choice, some environments, especially corporate intranet will continue to use it until second coming (and then Safari will rule the world).

So, here is a small tip: If you need to use a named color from CSS3+ specification that old tired browser doesn’t understand – just use color’s hex equivalent instead. For example instead of

style="border: solid 1px LightGray;"

which will do nothing in IE6 use

style="border: solid 1px #d3d3d3;"

which will render nice light-gray border.

UltraWebGrid does not display last column’s right border (solution)

If you’re using Infragistics UltraWebGrid and experienced an odd behavior where the grid does not display the right-most vertical border line – there’s a workaround.

By default 2 elements contribute to the grid border – border from RowStyleDefault property and border from FrameStyle property. For some reason IE6/7 (yes, some people still use those) do not render the right border of the last column, even though all 3 properties (BorderColor, BorderStyle and BorderWidth) are set. So the solution is to have FrameStyle lend that border:

  1. Expand RowStyleDefault -> BorderDetails property and set StyleRight to None – this is done, so the double border won’t render in IE8 and other browsers where the border is displayed correctly in the first place
  2. Expand FrameStyle -> BorderDetails property and set ColorRight, StyleRight and WidthRight properties to the desired color, style and width (e.g. LightGray, Solid, 1px)

As a result, the right border is displayed correctly in all versions of IE.

JavaScript IsDate(): Validate date according browser locale

In one of my recent projects I needed to validate whether user’s input is a valid date, and this needed to be done client-side, in browser prior submission to the server. Lazy as I am, I Googled for a ready-to-use code snippet. There’re plenty of versions out there, but most of them offer incomplete solution and none of them take into account browser locale, you know – the language settings:

So I decided to cook something of my own Continue reading →

WARP, UltraWebGrid and ScriptManager glitch in IE6 and IE7

This is probably a very obscure situation, but it happened to me, it could happen to someone else. Scenario: an ASP.NET page with Infragistics UltraWebGrid inside of a WARP panel. A button outside the WARP serves as a trigger for partial postback. First click on the button causes expected partial postback, but on the second click page does full postback and is screwed after that. The issue happens only in IE6/7, page works correctly in IE8.

Another condition – page contains ASP.NET AJAX ScriptManager control with ServiceReference path pointing to an ASMX WebService.

Turned out the issue was caused by project being left in debug mode (in web.config debug=”true”). Which caused WebService page to be loaded with parameter “jsdebug” in query string. Which apparently IE6 and 7 didn’t like very much. Switching to debug=”false” in web.config solved the problem.

How to Disable hyperlink clicks

Hyperlinks are designed for clicking, to lead you somewhere else, but sometimes this  behavior is undesired. In my case a grid control displayed some HTML data in its cells (including hyperlinks) and clicking on those links caused some undesired effects. I still wanted to display HTML and allow clicking on other grid elements (e.g. checkboxes) just needed a way to prevent hyperlinks clicks.

Remember that events bubble? That gave me an idea to wrap the grid control in a DIV to catch click events. This way I can check event source and if it’s a hyperlink – cancel the event, otherwise allow it. Well that’s pretty much it. Here’s a stump for the DIV wrapper:

<div onclick="return checkClickSrc()">
    <!-- Controls to check go here-->
</div>

and here’s the JavaScript code that does the check:

function checkClickSrc() {
    return event.srcElement.tagName != 'A'
    //for firefox: return event.target.tagName != 'A'
}

Excellent Freeware RAR password recovery utility

If you ever need to recover lost password to your RAR file (or, let’s be honest, unrar a file you got from the Internet), look no further than cRARk – beautifully done RAR password recoverer. It’s the only utility capable of using NVIDIA CUDA, which utilizes GPU for password permutations, and even without that it’s extremally fast. And it’s free!

You can download it at http://www.crark.net

“Cannot find column” DataTable error while grouping or sorting Infragistics UltraWebGrid

If you’re binding an ADO.NET DataTable to Infragistics UltraWebGrid and then programmaticaly sort the grid (e.g. add a column to a band’s SortedColumns collection) you may get an error:

Cannot find column My Column Name.

with stack trace starting from grid databinding and finishing in datatable’s sorting:

at System.Data.DataTable.ParseSortString(String sortString)
at System.Data.DataView.CheckSort(String sort)
at System.Data.DataView.set_Sort(String value)
at Infragistics.WebUI.UltraWebGrid.DBBinding.ProcessDataViewForFillRows(DataView dataView, RowsCollection rows)
at Infragistics.WebUI.UltraWebGrid.DBBinding.FillRows(UltraWebGrid grid, RowsCollection rows, IEnumerable datasource)
at Infragistics.WebUI.UltraWebGrid.DBBinding.BindList(IEnumerable datasource)
at Infragistics.WebUI.UltraWebGrid.DBBinding.DataBind(Object dataSource, String dataMember)
at Infragistics.WebUI.UltraWebGrid.UltraWebGrid.DataBind()

If the grid binds OK without sorting and grouping, but fails with either – most likely the culprit is one of the columns in data table. Continue reading →

Displaying consistent number of links in Infragistics UltraWebGrid Pager

In the previous post I described how using QuickPages property and a bit of creative HTML enhanced pager for Infragistics UltraWebGrid could be created. The only problem with QuickPages – the pager in this mode displays inconsistent number of page links. For example if you set QuickPages property equal 5, the pager will display from 5 page links (when you’re at the beginning or at the end of the grid) to 11 (when you’re in the middle). If you want that number to be consistent, you have to draw the page links yourself. Which turned out is surprisingly easy. Continue reading →