What I'm trying to do
I have an ASP.NET page which shows a list of items. Once the page has loaded, I perform an AJAX call to go and get the stock for every item. When the AJAX call returns, we then display an "in stock" or "out of stock" icon with an associated tooltip for each item. The tooltip will display the actual stock.
The problem
The tooltip is not just text but has formatting in it. I have got my code to work in Firefox 4, but it doesn't work in Internet Explorer 8.
The code
The tooltip text template is:
When the page first loads, I have a hidden label (style display = none) and I set this label's text property to that of the template text.
When my AJAX call returns, it runs a function. This function iterates through each item and performs the following:
Okay, a quick explanation of this JavaScript:
If I don't add this then I get an error if I attempt the next line. The error is "this._contentCell is null" and the solution was posted here: http://www.telerik.com/community/forums/aspnet-ajax/tooltip/client-side-set-content-to-dom-element.aspx
Earlier on in the function I create a reference "
In Firefox 4 and Chrome, calling
Here, I load the content of the tooltip and "[[stock]]" with the actual stock value returned from the AJAX call.
I then attempt to update the content of the tooltip
I had to show the tooltip to prevent the error, but ideally I don't want it to show when it first loads....this is my attempt to therefore hide it (but that doesn't seem to have the desired effect).
Any help would be much appreciated.
Thanks in advance
Griff
I have an ASP.NET page which shows a list of items. Once the page has loaded, I perform an AJAX call to go and get the stock for every item. When the AJAX call returns, we then display an "in stock" or "out of stock" icon with an associated tooltip for each item. The tooltip will display the actual stock.
The problem
The tooltip is not just text but has formatting in it. I have got my code to work in Firefox 4, but it doesn't work in Internet Explorer 8.
The code
The tooltip text template is:
In stock - <
span
style
=
'color: #ff0000;'
>[[stock]]</
span
> items
When the page first loads, I have a hidden label (style display = none) and I set this label's text property to that of the template text.
When my AJAX call returns, it runs a function. This function iterates through each item and performs the following:
tooltip.show();
tooltip.set_contentElement(inStockTextCached);
var
content = tooltip.get_content().replace(
""
[[stock]]
""
, fields[
" + QoHDisplay.QuantityOrdinal + @"
]);
tooltip.set_content(content);
tooltip.hide();
Okay, a quick explanation of this JavaScript:
tooltip.show();
If I don't add this then I get an error if I attempt the next line. The error is "this._contentCell is null" and the solution was posted here: http://www.telerik.com/community/forums/aspnet-ajax/tooltip/client-side-set-content-to-dom-element.aspx
tooltip.set_contentElement(inStockTextCached);
Earlier on in the function I create a reference "
inStockTextCached
" to the label that holds the template text. I then set the tooltip's content element to be the same.In Firefox 4 and Chrome, calling
set_contentElement(inStockTextCached)
works fine but in InternetExplorer it does not work.var
content = tooltip.get_content().replace(
""
[[stock]]
""
, fields[
" + StockOrdinal + @"
]);
tooltip.set_content(content);
I then attempt to update the content of the tooltip
tooltip.hide();
I had to show the tooltip to prevent the error, but ideally I don't want it to show when it first loads....this is my attempt to therefore hide it (but that doesn't seem to have the desired effect).
Any help would be much appreciated.
Thanks in advance
Griff