Tag Archives: html

Ultrawebgrid: Highlight row on MouseOver with Selection enabled

A while back I posted a method to highlight rows on mouse over in Infragistics UltraWebGrid. Over the time turned out that it had several limitations the main being: if you enable additional styling for some elements of the grid, they’re not preserved after mouse-over/mouse-out events. For example if you set a SelectedRowStyleDefault property with a different background and then move mouse over a selected row – that style will be removed.

So, here’s a complete solution to work around that limitation: Continue reading →

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'
}

UltraWebGrid in Infragistics 9 displays default column captions.

Recently I upgraded an ASP.NET project from ancient 6.3 version of Infragistics to current (at the moment) 9.2. Suddenly UltraWebGrid control began to display an unpleasant effect – columns that used to have no caption now showed what appeared to be default captions:

New look of UltraWebGrid

Looking at grid’s HTML markup I noticed that it set the caption to an empty string (showing code for one column):

<igtbl:UltraGridColumn HeaderText="">
   <Header Caption="">
   </Header>
</igtbl:UltraGridColumn>

Apparently it’s a new behavior in Infragistics 9.x to substitute empty captions with default column names. The solution is to set caption to a single space which, while invisible, is considered a real text caption and is not substituted by anything:

<igtbl:UltraGridColumn>
   <Header Caption=" ">
   </Header>
</igtbl:UltraGridColumn>

The result:

Correct look of UltraWebGrid

The value of the method attribute may not be html. Solution for the error.

If you get the following error while browsing a page in Internet Explorer:

The value of the ‘method’ attribute may not be ‘html’

chances are MSXML registration is corrupted on your machine. To fix this, open DOS prompt and type following commands:

regsvr32 msxml.dll
regsvr32 msxml2.dll
regsvr32 msxml3.dll

This will re-register MSXML and the error will go away.

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.

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 →