<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
#middle{
float:none;
}
#left{
float:left;
}
#right{
float:right;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div style="font-family:Arial">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">
<Columns>
<asp:TemplateField >
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" OnClick="LinkButton1_Click"
Text='<%# Eval("USERID").ToString() +" "+ Eval("USERNAME").ToString() +" "+ Eval("USERPOSITION").ToString()%>' runat="server"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SOConnectionString %>" ProviderName="<%$ ConnectionStrings:SOConnectionString.ProviderName %>" SelectCommand="SELECT USERID, USERNAME, USERPOSITION FROM USERMASTER"></asp:SqlDataSource>
</form>
</body>
</html>
here is my code and when Eval() retrieve the USERID from database, it couldn't show mandarin. All the character became ???. anyone can help me on this? On previous if I use C# then it will show mandarin wihtout any coding behind. maybe it is asp.net. anyone have any idea?
这是我的代码,当Eval()从数据库中检索USERID时,它无法显示普通话。所有角色都变成了???有谁可以帮我这个?在之前,如果我使用C#,它将显示普通话,而不是任何编码背后。也许是asp.net。有谁有任何想法?
1 个解决方案
#1
Make sure that a character encoding is specified. See Specifying the document's character encoding on how this can be done.
确保指定了字符编码。请参阅指定文档的字符编码,了解如何执行此操作。
Make sure that the character encoding is the same for the document and the result of the Eval
statement.
确保文档的字符编码与Eval语句的结果相同。
#1
Make sure that a character encoding is specified. See Specifying the document's character encoding on how this can be done.
确保指定了字符编码。请参阅指定文档的字符编码,了解如何执行此操作。
Make sure that the character encoding is the same for the document and the result of the Eval
statement.
确保文档的字符编码与Eval语句的结果相同。