Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1365
Enters in rowtemplate
posted

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.

Parents
No Data
Reply
  • 3595
    posted

    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.

    HeirarchicalGridWithTemplatingArchive.zip
Children