This is a migrated thread and some comments may be shown as answers.

the string contain "<k" after the letter "<k" cannot see the string in radgrid

3 Answers 35 Views
Grid
This is a migrated thread and some comments may be shown as answers.
M Kumar
Top achievements
Rank 1
Iron
Veteran
M Kumar asked on 23 May 2019, 09:52 AM

Hi 

             The string contain "<k" in between "FQH<k$/[3:9DxL+!" in when i show this name  in rad gird but it only show  first three letter after the "<k" dose not show. the screen shot show below.

http://prntscr.com/nsa4du

               If give space  between "<k" like this "FQH < k$/[3:9DxL+!"  it show in fully as show in the screen shot

http://prntscr.com/nsa7m0

 

 

3 Answers, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 28 May 2019, 07:36 AM
Hello,

The HTML that the given string results in is <td>FQH<k$/[3:9DxL+!</td> which the browser tries to interpret as an HTML and the result is this: <td>FQH<k$ [3:9dxl+!<="" td=""></k$></td>. As the <k$> element has no text, it is not visible on the page.

The solution to this is setting the HtmlEncode property to true for the column that contains such strings.

Regards,
Peter Milchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
M Kumar
Top achievements
Rank 1
Iron
Veteran
answered on 29 May 2019, 05:10 AM

hi peter,

           Thanks for ur reply. i use 

<telerik:GridTemplateColumn HeaderText="Field1>
                                <ItemTemplate>
                                    <asp:LinkButton ID="Label1" runat="server"
                                        Text='<%# Bind("[Field1]") %>'> </asp:LinkButton>
                                </ItemTemplate>
                            </telerik:GridTemplateColumn>

 

in this we cannot get html encode. so i how to fix the problem pls reply soon.

0
Peter Milchev
Telerik team
answered on 31 May 2019, 01:29 PM
Hello,

When it is a TemplateColumn, the encoding should be done manually, for example as suggested here: https://stackoverflow.com/a/4018974/10759760

Also, if you are using the template column only to show data, Eval can be used instead of Bind.

<ItemTemplate>
    <asp:LinkButton ID="Label1" runat="server"
        Text='<%# HttpUtility.HtmlEncode( Eval("ShipCountry")) %>'> </asp:LinkButton>
</ItemTemplate>


Regards,
Peter Milchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
M Kumar
Top achievements
Rank 1
Iron
Veteran
Answers by
Peter Milchev
Telerik team
M Kumar
Top achievements
Rank 1
Iron
Veteran
Share this question
or