Javascript change from VS 2005 to VS 2008

J

Joe Fallon

When you move the mouse over a bar in this chart, the arrow cursor is
supposed to change into a hand cursor under certain conditions.
Those conditions are evaluated using client side javascript.

The key point here is that the javascript code ran correctly in VS 2005 and
..Net 2.0.

After upgrading to VS 2008 and .Net 3.5 the javascript runs differently!

For example, the variables for column_label and row_label are supposed to be
strings like this:
"Dec 31, 2007" and "N/A"

When the javascript function runs the chart sends these values to the
function as parameters.
In VS 2008 the parameters to the function are url encoded!

So instead of the values above you get these:
"Dec 31%2c 2007" and "N%2fA"

So the rest of the code which is expecting the correct values is now broken.

I fixed the specific functions for the chart by changing it to:
decodeURIComponent(column_label)
decodeURIComponent(row_label)

But I am very worried about the possible effects this change may have on our
javascript code everywhere else in the application.

Why is this happening happening? What has changed?
Some pages in the application use AJAX. Could that be affecting things?
Also, is there a Setting that can be used to get the old behavior?

Joe
 
B

bruce barker

without see the code that renders the links, it hard to tell. probably a bug
fix to properly encode a url. for example:

<a href="javascript:doCall('my string');">click</a>

should be rendered as:

<a href="javascript:doCall('my%20string');">click</a>

note: doCall will receive the string "my string", as the encoding is only
for the href attribute

-- bruce (sqlwork.com)
 
J

Joe Fallon

These are the 2 javascript functions which worked correctly in VS2005.
The Infragistics grid raises events when the mouse moves over the bar in the
chart and when you click the bar on the chart.

The parameters row_label and column_label have values like this in VS 2005:
"Dec 31, 2007" and "N/A"

In VS 2008 they are like this: "Dec 31%2c 2007" and "N%2fA".

The isDate function is something I wrote to test if a string is a date and
works fine for "Dec 31, 2007".

Also you can see that this code will fail in VS 2008:
if (row_label=='N/A')

================================================================================
function mChart_ClientOnMouseOver(this_ref, row, column, value, row_label,
column_label, evt_type, layer_id)
{
if (this_ref.EnableTooltipFading && (isDate(column_label) ||
isDate(row_label)))
{
document.Form1.style.cursor='pointer';
}
}

================================================================================

function mChart_ClientOnMouseClick(this_ref, row, column, value, row_label,
column_label, evt_type, layer_id)
{
if (this_ref.EnableTooltipFading && (isDate(column_label) ||
isDate(row_label)))
{
if (row_label=='N/A')
{
RightSideWin('KpiDrilldown.aspx?enddate=' + column_label + '&mdpcode='
+ '' + '','MyDrilldown');
}
else
{
RightSideWin('KpiDrilldown.aspx?enddate=' + row_label + '&mdpcode=' +
column_label + '','MyDrilldown');
}
}
}

================================================================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top