locked
GridView with bad chars RRS feed

  • Question

  • User-909867351 posted

    Hi

    I have one gridview with this code:

    <asp:GridView ID="GridView1" CssClass="table table-hover " GridLines="None" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" OnRowCommand="GridView1_RowCommand">
                                        <Columns>
                                            <asp:TemplateField HeaderText="Apagar">
                                                <ItemTemplate>
                                                    <asp:ImageButton ID="ImageButton1" CommandName="apagar" CommandArgument='<%#Eval("id")+";"+Eval("nome") %>' runat="server" ImageUrl="~/imagens/delete.png" />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                            <asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" SortExpression="id" ItemStyle-CssClass="hiddencol" HeaderStyle-CssClass="hiddencol" />
                                            <asp:BoundField DataField="nome" HeaderText="nome" SortExpression="nome" />
                                            <asp:TemplateField HeaderText="Alterar">
                                                <ItemTemplate>
                                                    <asp:ImageButton ID="ImageButton2" CommandName="editar" CommandArgument='<%#Eval("id")+";"+Eval("nome") %>' runat="server" ImageUrl="~/imagens/edit.png" />
                                                </ItemTemplate>
                                            </asp:TemplateField>
                                        </Columns>
                                    </asp:GridView>

    The field nome show chars like that in the grid

    grelha

    but in mysql file all is ok

    mysql

    It seems the website does not support portuguese chars. How to solve this issue?

    My sql command 

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand="select * from entidades where id<>5"></asp:SqlDataSource>

    Thank you

    Wednesday, August 7, 2019 9:31 PM

Answers

  • User288213138 posted

    Hi mariolopes,

    Please check if your operating system, browser application and website support displaying Portuguese language.

    I tested it on my chrome, Firefox, IE and Edge. They all display normally.

    what is the type of encoding or character set you are using for the application?

    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Unable to display language problems properly.aspx.cs" Inherits="case_solution.Rendering_issues.Unable_to_display_language_problems_properly" %>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
               
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
                    <Columns>
                        <asp:BoundField DataField="nome" HeaderText="nome" SortExpression="nome" />
                    </Columns>
    
                </asp:GridView>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:CaseTestConnectionString %>" SelectCommand="SELECT [nome] FROM [Test33]"></asp:SqlDataSource>
            </div>
        </form>
    </body>
    </html>
    

    Here is an article about how to set the display characters in chrome for your reference. https://itstillworks.com/display-japanese-characters-google-chrome-14542.html

    If you haven't solved the problem, please post you aspx code.


    Best regards,
    Sam

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, August 8, 2019 5:32 AM