Yearly Archives: 2011

How to load IFRAMEs in order according to priority

Let’s say you have a Web page that displays “widgets” a small islands of information. And internally those widgets are IFRAME elements, whose source is loaded dynamically from the same server at runtime in client side JavaScript. So, you have a code similar to this:

var aIframes = document.getElementsByTagName('IFRAME');
for (var I = 0; I < aIframes.length; I++) {
    aIframes[I].src = aIframes[I].getAttribute('originalURL')
}

This (oversimplified) code assumes that URL for IFRAME source already stored as a custom attribute ‘originalURL’ of IFRAME element (for example placed there by server-side code), but it can equally come from other sources. This approach is usually taken so IFRAMES can initially display a static page with “Please wait. Loading…” animation meanwhile dynamically loading real data – creates a better user experience.

The code loops thru all IFRAMEs setting their SRC attribute, displaying content, so you would see something like

IFRAME widgets

It’s all well and good, but there’s a small problem. SRC of IFRAMEs is assigned in order of their appearance on the page and if URLs are pointing to the same server and one of the earlier IFRAMEs takes a long time to load – it will block the rest of the IFRAMEs from loading. Continue reading →

WHDG: RowIslandsPopulating event fires multiple times

I’ve been successfully using manual load on demand in WebHierarchicalDataGrid for a while now, but recently noticed strange thing. The deeper in grid’s hierarchy I expanded the children – the slower it went.

In my case every time user clicks [+] to expand a row, VB.NET code calls an SQL Server Stored procedure to bring in child rows. I grew suspicious and fired up SQL Profiler. What I saw surprised me. Number of calls to the stored procedure increased the deeper in grid’s hierarchy I expanded the children. When I clicked [+] on the root level it resulted in 1 SP call. Clicking [+] on the child to expand grandchild – 2 calls. Expanding grandchild to see grand-grandchild rows – 3 calls, etc. Continue reading →

onbeforeunload event is fired on click

onbeforeunload browser’s event fires when the window is about to navigate to another page or about to be closed. So why why would it fire when you click to call a JavaScript function that does neither of the two?

If your have your click setup similar to something like this:

<a href='javascript:doStuff()'>Click to do something</a>

or, if you’re using ASP.NET’s HyperLink control:

<asp:HyperLink ID="xhypMuLink" runat="server" NavigateURL="javascript:doStuff()">
   Click to do something
</asp:HyperLink>

And your “doStuff()” function doesn’t redirect or closes the window – you’d expect it just do its stuff and that’s it. But in addition to it, or rather before it onbeforeunload event fires, so if you have some code in the event handler – it will be executed, which in this case is undesirable.

Why does it happen? Continue reading →

WebHierarchicalDataGrid: Extra Row after Update

If after upgrading to a new version of Infragistics NetAdvantage you suddenly found your WHDG sprouting an extra blank row on top:

Extra Row in Aikido WHDG

most likely it’s because grid’s ItemCssClass property is used. In theory (at least according to ever so verbose documentation) it should define what grid’s cells look like. In practice it have no effect whatsoever. Or rather had no effect until upgrade (verified in version 2011.1, perhaps even earlier). Now if your CSS class used in this property contains HEIGHT attribute – a blank row of that height will be inserted on top of the grid.

Solution? Remove ItemCssClass property. It’s useless anyway.

UltraWebGrid: “Invalid Argument” error after upgrade

One would think that classic UltraWebGrid control would not be touched by 2010+ Infragistics NetAdvantage upgrades, perhaps some bugs would be fixed, but definitely no new ones should be introduced – since no new development is done on the control.

One would be mistaken, The Adventure Of Upgrading liveth on.

If you’re using UltraWebGrid, and its columns’ width is set as a percentage and some columns are hidden, e.g. you have something like this:

<igtbl:UltraGridColumn Key="COL1" Width="25%" Hidden="True">
   <Header Caption="My Important Column"></Header>
</igtbl:UltraGridColumn>

And you try to unhide the column in client-side JavaScript code like this:

var oBand = igtbl_getGridById('xMyGrid').Bands[0];
oBand.getColumnFromKey("COL1").setHidden(false);

You will get an error: Invalid argument deep in the jungle of Infragistics JavaScript code. What the?! It worked fine before the upgrade! Continue reading →

WebDataMenu: Incorrect displaying after upgrade

This is the second post in saga titled Upgrading Infragistics Controls to a new version. Chances are that your WebDataMenu looks weird after upgrade to 2010+ version. In my case the menu had following options/features:

  • It was a context popup menu, called on right mouse click
  • Text of menu items was assigned dynamically at runtime in JavaScript Client code

After upgrading NetAdvantage from version 2009.2 to 2011.1 strange things started to happen. Text of the menu items was cut short, submenues appeared at wrong places it looked like something from a Dali’s painting.
Numerous experiments later I found out that the problem was with EnableScrolling property of the menu control. Setting it to False returned menu to realm of realism.

WebHierarchicalDataGrid: JavaScript errors after upgrade

Upgrading 3rd party library to a new version is bound to have problems and Infragistics is no exception. In my case I was upgrading NetAdvantage for ASP.NET from version 2009.2 to to 20011.1 and right away WebHierarchicalDataGrid started to crash client-side. If ScriptManager was in debug mode I’d get error:

Microsoft JScript runtime error: Sys.ArgumentUndefinedException: Value cannot be undefined.Parameter name: type

With ScriptManager in Release mode it’d be:

Microsoft JScript runtime error: Object expected

But always in Sys.Component.Create – it looked like grid’s client-side scripts weren’t loading at all. After A LOT of digging I found out that the culprit was grid’s server-side Bands.Clear() method. When called, it caused client-side WHDG JavaScript not to load. When that method was commented – JavaScript errors disappeared. So until Infragistics comes out with a bug fix – if you experience similar problem, try to avoid Bands.Clear() method.

Restore bricked DROID 3 phone

If you bricked your Motorola DROID 3 phone while rooting it, installing some custom ROM or doing other fun stuff – don’t despair, there’s light at the end of the tunnel.

(Disclaimer: I am not responsible for anything that happens to your phone. But then again, if you’re reading this, something already has happened to it).

  1. Download the Motorola Stock Image (SBF) v5.6.890 HERE
  2. Download Motorola Flashing Utility (RSDLite) v5.5 HERE
  3. Extract the contents of the SBF file to a folder on your computer
  4. Install RSDLite
  5. Boot your DROID 3 into bootloader by holding both Vol+Vol- at the same time when powering on the phone
  6. Select “AP Fastboot” from boot menu by pressing Vol- repeatedly and then press Vol+ to select it
  7. Open RSDLite and browse for the XML in the folder where you extracted the SBF file
  8. Connect the phone to PC via USB, and when RSDLite  says  “Connected”, hit “Start
  9. Wait for the phone to finish flashing, and booting (it can reboot several times, let it be)

You’re done! Your phone is resurrected, feel free to root it, install custom ROMs and do other fun stuff again.

NOTE: You phone may require activation after the flash, just follow original Verizon activation steps (if you’re not prompted to activate your phone and still have no connection just dial *228 and follow the instructions).

CREDITS: Thanks chevycam94 for original SBF-ing instructions and files. As a matter of fact these instructions are pretty much exact copy of first 9 steps of his instruction on how to flash his custom ROM Steel Droid – check it out!

Pass NULL value to SSRS Report from ReportViewer

When working with ReportViewer ASP.NET control to display SSRS report on an ASPX page you can use ReportParameter class to create and pass parameters to the server, e.g.

aParamList.Add(New ReportParameter("MyParam", sValue, False))

Here aParamList is a Generic List of ReportParameter objects that you use in ReportViewer’s ServerReport.SetParameters method, "MyParam" is a parameter name and sValue is a string variable with value for the parameter. Third parameter – visibility, when set to False makes the parameter hidden.

All is well, but what if you need to pass NULL parameter? Unfortunately ReportParameter‘s constructor accepts only string type for it’s value parameter, so you cannot pass something like DBNull.Value or Nothing. Fortunately there’s an easy solution: Just set you string variable representing value to Nothing:

sValue = Nothing
aParamList.Add(New ReportParameter("MyParam", sValue, False))

Voila! Desired NULL is passed as a parameter value (on SSRS side parameter has to be set to accept NULL values).

Thanks Tincy for the original idea.

IE8: Display borders around empty cells

By default Internet Explorer 8 does not display blank cells in HTML tables (technically it does’t show borders around such cells) and visuals aren’t pretty. The solution below may not work for everybody, but I’d imagine will help in many cases:

Just set the table style to

border-collapse:collapse

Presto-chango! Missing borders now appear.