简体   繁体   English

ASP.Net ListView给出空白的特殊字符记录

[英]ASP.Net ListView give Blank Records for Special Characters

I have a asp.net ListView control which is bound to a data source using the DataSourceId. 我有一个asp.net ListView控件,该控件使用DataSourceId绑定到数据源。

<asp:ListView ID="myListView" runat="server" DataKeyNames="*****" DataSourceID="myDataSource">

The Data source gets data from the SQL Server using the myDataSource.SelectCommand . 数据源使用myDataSource.SelectCommand从SQL Server获取数据。

In the resulting list view, rows blanks out where there are special characters such as é in the sql table row. 在结果列表视图中,在SQL表格行中存在特殊字符(例如é )的地方,行将变为空白。 (double checked using SQL Management Studio) (使用SQL Management Studio再次检查)

I think this may be due to a UNICODE issue, but how can i solve this issue in the ListView ? 我认为这可能是由于UNICODE问题引起的,但是如何在ListView中解决此问题呢?

This is not a issue with Listview, it looks when you are pulling out data in .net, these Unicode is getting converted to blank spaces. 这不是Listview的问题,当您在.net中提取数据时,这些Unicode会转换为空格。

This is just a example with textfile having UniCode 这只是具有UniCode的文本文件的示例

 using (StreamReader reader = new StreamReader(@"D:\input.txt", Encoding.Unicode))
    {
        label1.Text = reader.ReadToEnd();
    }

You can try with this and will understand what I am trying to say. 您可以尝试一下,并且会理解我要说的话。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM