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

4 posts, 0 answers
  1. M Kumar
    M Kumar avatar
    113 posts
    Member since:
    Apr 2008

    Posted 23 May 2019 Link to this post

    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

     

     

  2. Peter Milchev
    Admin
    Peter Milchev avatar
    804 posts

    Posted 28 May 2019 Link to this post

    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.
  3. M Kumar
    M Kumar avatar
    113 posts
    Member since:
    Apr 2008

    Posted 29 May 2019 in reply to Peter Milchev Link to this post

    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.

  4. Peter Milchev
    Admin
    Peter Milchev avatar
    804 posts

    Posted 31 May 2019 Link to this post

    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.
Back to Top