jQWidgets Forums
jQuery UI Widgets › Forums › Grid › Escaping angle brackets
This topic contains 5 replies, has 3 voices, and was last updated by Gopre400 11 years, 1 month ago.
-
AuthorEscaping angle brackets Posts
-
Hello,
trying to show text in a grid containing angle brackets results in hiding them as well as the text between them:
Lorum epsum hello <friendly> world.
results in
Lorum epsum hello world.
because it seems that <friendly> is added as a tag to the DOM. Escaping it on the server side doesn’t help.What’s the right way to escape it?
Thanks in advance,
EmanuelHi Emanuel,
As far as I know, the way to escape brackets is to encode them as: <code> instead of
<code>
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi, I have a similar situation, left brackets “<” in text. How do I escape a data field in a grid?
Hi Gopre400,
Take a look at: http://stackoverflow.com/questions/10462348/right-angle-bracket-in-html
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comThank you Peter, I looked at the link you provided but it doesn’t really answer the question. It says you need to encode the characters which I have done doing this…
Public Function GetSRQViewStreetPlatesGrid() As String
Dim cmd As New SqlCommand()
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = “spSRQRequestsStreetPlatesOpen”
Dim data As DataSet = GetSRQViewStreetPlatesData(cmd)
Dim dr As DataRow
Dim dt As DataTable
dt = data.Tables(0)
For Each dr In dt.Rows
dr(“SignText”) = Uri.EscapeDataString(dr(“SignText”))
Next
Dim writer As New System.IO.StringWriter()
dt.WriteXml(writer, XmlWriteMode.WriteSchema, False)
Return writer.ToString()
End FunctionBut how do you decode the characters to display in a grid? I tried using the unescape function but does not work (data with < does not display).
{ text: ‘Text’, datafield: ‘SignText’, width: 200, editable: false, cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
return unescape(rowdata.SignText);
}
},I got it to work…first remove the escape in the code behind…
Public Function GetSRQViewStreetPlatesGrid() As String
Dim cmd As New SqlCommand()
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = “spSRQRequestsStreetPlatesOpen”
Dim data As DataSet = GetSRQViewStreetPlatesData(cmd)
Dim dt As DataTable
dt = data.Tables(0)
Dim writer As New System.IO.StringWriter()
dt.WriteXml(writer, XmlWriteMode.WriteSchema, False)
Return writer.ToString()
End FunctionThen return cellsrenderer like this…
{ text: ‘Text’, datafield: ‘SignText’, width: 200, editable: false, cellsrenderer: function(row, columnfield, value, defaulthtml, columnproperties, rowdata) {
return rowdata.SignText.replace(“<“, less than code).replace(“>”, greater than code);
}
},(because this is html I wrote out “less than code”)
-
AuthorPosts
You must be logged in to reply to this topic.