Dear Infragistics,
We have a hierarchical datagrid with a rowtemplate. In that rowtemplate we have an image which needs to call a javascript on click. It passes along as a variable a piece of XML. This works fine.
Looks like this: .RowTemplate("<td> {{if (${HasTemplate} =='true')}} <input type=\"image\" src=\"" + @Url.Content("~/Resources/MagnifyingGlass.png") + "\" align=\"left\" title=\"Details bekijken\" alt=\"Details bekijken\" onclick=\"popUpTemplate('${Template}');\"/> {{/if}} </td>")
Except when the content (see: ${Template}) contains enters (\r\n), then it seems the onclick is never set. I say never set, because I've put a breakpoint at the 1st line in the javascript popUpTemplate and it's never hits that breakpoint (debugged in Firebug).
Ofcourse the easy way out is to do something clever with the /r/n's, but I thought perhaps you've encountered this behaviour before and know how to properly tackle it.
Thank you very much in advance for replying.
Hello Danny,
Thank you for posting in our community.
We have made an initial review of your query and I have prepared a sample in order to test your scenario. In this sample it is checked if the record Id is greater than 1. If the conditional value is true the cell is made clickable. Then when clicked an alert containing the record name is displayed.
In cases when \r\n is present in the field value, an exception is in fact thrown in the sample as the string passed to the handler function is undetermined due to the newline. A possible solution is to handle these special characters directly in the data source.
If you could provide us with an example where the issue occurs where there isn't a \r\n value in the data source, I can research further what the cause of the issue is and whether an approach exists in this scenario which does not require examining and modifying the data source.
Feel free to modify the sample and use it if needed.
Looking forwards to hearing from you.
I am still following up your case. If you have any further questions don’t hesitate to contact me.
Well thank you for replying. And it's not your fault ofcourse. But the website is in production now. This question is a month old, what did you expect? I already found a work around a month ago. I had too. My employer doesn't have a month to wait. I translate all enters to a different character before passing it into javascript. In javascript I translate the characters back to enters. Thank you for replying, but you can close this case...