I'm working with ASP.NET MVC, C#.NET and Infragistic's jQuery controls. My MVC igGrid in the View has a RowTemplate like so:
.RowTemplate("<tr><td> {{if ${IsUrgent}=='true'}} <img src=\"" + @Url.Content("~/Resources/Exclamation.png") + "\" align=\"left\" title=\"Urgent\" alt=\"Urgent\"/> {{/if}} </td><td> <a href=\"" + @Url.Action("EditRemark", "Home") + "/?id=${ID}&patientID=${PatientID}&patientFullName=${PatientFullName}\"><img src=\"" + @Url.Content("~/Resources/Edit.png") + "\" align=\"left\" title=\"Opmerking wijzigen\" alt=\"Opmerking wijzigen\"></a> </td><td> ${StartDate} </td><td> ${EndDate} </td><td> <input type=\"image\" src=\"" + @Url.Content("~/Resources/DeleteIcon.png") + "\" align=\"left\" title=\"Opmerking beëindigen\" alt=\"Opmerking beëindigen\" onclick=\"ConfirmSettingEnddateRemarkToYesterday('${ID}');\"/> </td><td> ${Content} </td><td> {{if (${HasTemplate} =='true')}} <input type=\"image\" src=\"" + @Url.Content("~/Resources/MagnifyingGlass.png") + "\" align=\"left\" title=\"Details bekijken\" alt=\"Details bekijken\" onclick=\"popUpTemplate('${DisplayableTemplate}');\"/> {{/if}} </td><td>${PatientFullName}</td></tr>")
This question is about the onclick=\"popUpTemplate('${DisplayableTemplate}');\" bit, which works fine usually.
DisplayableTemplate contains a string. This string looks like (it's XML):
<Template id="7" name="Overdrachtsformulier SHOKO en CHP ZOB" urgent="false" patientname="van Achternaamtestuh-de Partnerachternaamtestuh"><Description>Overdrachtsformulier huisartsenposten SHOKO en CHP Zuidoost Brabant voor terminale (oncologisch, COPD, hartfalen etc.) en andere complexe en aandachtvragende zorg</Description><Field><Label>Eerste melding</Label><ControlType>CheckBox</ControlType><Content>Nee</Content></Field><Field><Label>Vervolg melding</Label><ControlType>CheckBox</ControlType><Content>Nee</Content></Field><Field><Label>Regulier</Label><ControlType>CheckBox</ControlType><Content>Nee</Content></Field><Field><Label>Start paliatief traject</Label><ControlType>CheckBox</ControlType><Content>Nee</Content></Field><Field><Label>Start paliatief terminale fase</Label><ControlType>CheckBox</ControlType><Content>Nee</Content></Field><Field><Label>Waarnemer vd eigen huisarts</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Mobielnr</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Behandelend arts is bereikbaar</Label><ControlType>CheckBox</ControlType><Content>Nee</Content></Field><Field><Label>Behandelend arts draagt over aan HAP</Label><ControlType>CheckBox</ControlType><Content>Nee</Content></Field><Field><Label>Behandelend arts draagt over aan HAP - periode (op datum:.... van....uur tot .....uur)</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Behandelend arts is alleen bereikbaar - als</Label><ControlType>MultilineTextBox</ControlType><Content /></Field><Field><Label>Behandelend arts draagt zorg volledig over</Label><ControlType>CheckBox</ControlType><Content>Nee</Content></Field><Field><Label>Overlijden melden - overdag</Label><ControlType>CheckBox</ControlType><Content>Nee</Content></Field><Field><Label>Overlijden melden - 's avonds</Label><ControlType>CheckBox</ControlType><Content>Nee</Content></Field><Field><Label>Overlijden melden - 's nachts</Label><ControlType>CheckBox</ControlType><Content>Nee</Content></Field><Field><Label>Bij overlijden per fax melden</Label><ControlType>CheckBox</ControlType><Content>Nee</Content></Field><Field><Label>Bij overlijden telefonisch melden</Label><ControlType>CheckBox</ControlType><Content>Nee</Content></Field><Field><Label>Diagnose, relevante comorbiditeit en prognose</Label><ControlType>MultilineTextBox</ControlType><Content /></Field><Field><Label>Actuele medicatie</Label><ControlType>MultilineTextBox</ControlType><Content /></Field><Field><Label>Huidige situatie en (te verwachten) problemen</Label><ControlType>MultilineTextBox</ControlType><Content /></Field><Field><Label>Behandeling en stappenplan</Label><ControlType>MultilineTextBox</ControlType><Content /></Field><Field><Label>Reanimeren</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Nog bereid tot ziekenhuisopname zonodig</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Antibiotica bij levensbedreigende complicaties</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Levensverlengend handelen</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Wilsverklaring aanwezig</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Overige relevante afspraken</Label><ControlType>MultilineTextBox</ControlType><Content /></Field><Field><Label>Er is inzet vd thuiszorg</Label><ControlType>CheckBox</ControlType><Content>Nee</Content></Field><Field><Label>Telefoonnr thuiszorg</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Draagkracht mantelzorg (goed / voldoende / zorgwekkend /n.v.t.)</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Patient is bekend bij ziekenhuis</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Naam ziekenhuis</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Telefoonnr ziekenhuis</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Patient is bekend bij specialist</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Telefoonnr specialist</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Overige opmerkingen</Label><ControlType>MultilineTextBox</ControlType><Content /></Field></Template>
However, when onclick=\"popUpTemplate('${DisplayableTemplate}');\" bit is rendered to the browser I saw in Firefox Firebug that this string looks like:
<input type="image" align="left" onclick="popUpTemplate('<Template id="7" name="Overdrachtsformulier SHOKO en CHP ZOB" urgent="false" patientname="van Achternaamtestuh-de Partnerachternaamtestuh"><Description>Overdrachtsformulier huisartsenposten SHOKO en CHP Zuidoost Brabant voor terminale (oncologisch, COPD, hartfalen etc.) en andere complexe en aandachtvragende zorg</Description><Field><Label>Eerste melding</Label><ControlType>CheckBox</ControlType><Content>Nee</Content></Field><Field><Label>Vervolg melding</Label><ControlType>CheckBox</Contro...eld><Field><Label>Naam ziekenhuis</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Telefoonnr ziekenhuis</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Patient is bekend bij specialist</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Telefoonnr specialist</Label><ControlType>TextBox</ControlType><Content /></Field><Field><Label>Overige opmerkingen</Label><ControlType>MultilineTextBox</ControlType><Content /></Field></Template>');" alt="Details bekijken" title="Details bekijken" src="/Resources/MagnifyingGlass.png">
Note the </Contro...eld> bit which should be: </ControlType><Content>Nee</Content></Field>
This does not occur when the string is smaller. So it seems that at a certain point the string is too big and this error occurs.
Can you please help?
Hello Dannyvdk,
Thank you for sharing your solution !
Thank you very much for your efforts so far. Unfortunatly I found the problem myself and forgot to report the solution here. I apologize.
The problem takes place because of the ' in the string. When it's rendered to the browser its recognized by the browser as a termination of the string. The solution was to use escape characters.
it had nothing to do with the length of the string (tunnelvision).
Again, I'm sorry to have bothered you.
Hello DannyvdK,
I have tested this scenario with various long strings to check whether the issue is occurring due to the sheer length of the string. So far the issue does not appear to be reproducible based on the string length. I have noticed that while in the rendered output your XML content is shortened, this does not appear to happen randomly as in the omitted parts theContenttag is self-closed. Therefore it is likely that there is a application specific issue here. A small sample illustrating the behavior would be greatly appreciated and would allow me to examine the matter further and provide more feedback.
Please do not hesitate to contact me with any updates or questions.