We managed to bind an object to the grid. One of the properties of the object is a string that contains xml. This xml contains some detail information that the users might want to view. With templating we managed to show an icon in case the template is present, like this:
<td> {{if ${Template} !=""None""}} <input type=""image"" src=""../Resources/MagnifyingGlass.png"" align=""left"" onclick=""popUp(${Template});""/> {{/if}} </td>
In this case ${Template} is the string that contains the xml.
This does work fine in Firefox. When the image gets pressed the javascript gets executed and details are shown to the user. However in IE we get the exclamation sign stating that the page loaded with errors. While at first glance everything seems to have loaded with no problems we are unable to click the button that will show us the detail information.
When I place an imagebutton like the one on the grid directly on the page there is no problem with the execution, so my guess is that there is something up with the combination of the xml, the row templating and IE. Do you have any clue what might be up here?
PS.
The xml that we use for testing looks like this:
<Template> <Description>This is a test</Description> <Field> <Label>TestLabel</Label> <Content>This is a test</Content> </Field></Template>
I should tell you that I'm mostly kidding about VB ;) - sure, it's hard for me to understand, but it's your language of choice and I respect that.About the XML and IE - I can tell you for sure the this works in all browsers (IE included):
popUp('<Template><Description>This is a test</Description><Field><Label>TestLabel</Label><Content>This is a test</Content></Field></Template>');
In my personal opinion, if you can get your server-side to generate this into the page's source code, you will have a solution to your problem.
Cheers!Borislav
No problem. Talking about a good sample makes it easier for both of us :). (You might also like to know that we will be switching to C# during this year, so it will even get better :)).
I tried what you suggested, but it does not seem to help as the same error still occurs. But your suggestion got me thinking and my guess is the IE tries to interpret the XML as if it is part of the HTML, since it encounters a "<". So maybe it might not be possible to pass XML along like that at all in IE.
A-ha!Thank you very much for the sample - I wish all asking people on the forums could provide samples like yours (nope, not on VB, but with sufficient details to reproduce the problem :)) So, here's the problem: as soon as the child grid begins to render (when you expand a root grid row), this is the onclick for the TemplateXML column:
popUp(<Template> <Description>This is a test</Description> <Field> <Label>TestLabel</Label> <Content>This is a test</Content> </Field> </Template>);
Now, Firefox lets you get away with this, but IE is much more strict and says "hey, this isn't a single-line Javascript code - it has new lines in it and it's not a string as well - what are you trying to do?!"Now, the problem comes from your data - even before it can be manipulated by the igGrid (by using a formatter function for example), the syntax error is already thrown by IE.What I can recommend is to cast the TemplateXML column's data to string and to remove allnew line characters from it on the client side. I'm no VB expert so I'll just keep my fingers crossed - feel free to provide me with an update to your solution if this suggestion doesn't work out.
I have a sample that will show the behaviour exactly as I described.
Since I see an error from toString I might need to clarify that the property we bind to the grid is of the type string. It is just filled with xml, so in my opinion no toString call would need to be made.
We want to pass this string into a javascript function that generates the html for the detail view we want (and this works with Firefox).
The error we get with IE is very non-descriptive (at least to me). Webpage error detailsUser Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; InfoPath.1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET4.0C; .NET4.0E)Timestamp: Tue, 29 May 2012 13:27:16 UTCMessage: Syntax errorLine: 1Char: 7Code: 0URI: http://localhost:2764/patient/getpatientlistI am not sure if it is any help, but the icon only appears after expanding the grid (the button to view the details is place on the level that expands).
I will look into getting a sample with this behaviour.