如何在 ASP.Net Query Extender 数据字段搜索中删除区分大小写?
how to remove case sensitivity in ASP.Net Query Extender data field search?
我在三个字段的文本框中应用了查询扩展器。它可以工作,但区分大小写。例如如果用户名字段的名称为 "AWAIS" 而我搜索 "awais" ,它不会搜索,反之亦然。我怎样才能消除敏感性?
我的代码是
<td>
<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="BookStore.Bussines.Entities.BookStoreEntities"
OnSelecting="LinqDataSource1_Selecting">
</asp:LinqDataSource>
<asp:QueryExtender ID="qeSearch" runat="server" TargetControlID="LinqDataSource1">
<asp:SearchExpression DataFields="DISTRIBUTOR_NAME,DISTRIBUTOR_CODE,DISTRIBUTOR_URL" SearchType="Contains">
<asp:ControlParameter ControlID="txtSearchDistributor" />
</asp:SearchExpression>
</asp:QueryExtender>
</td>
如果您查看有关此控件的 MSDN 文档,您会了解如何处理区分大小写:
Case sensitivity in the search expression depends on the LINQ provider that you specify in the QueryExtender control.
试试这个:
将SearchExpression.ComparisonType
设置为StringComparison.OrdinalIgnoreCase
<asp:SearchExpression DataFields="DISTRIBUTOR_NAME,DISTRIBUTOR_CODE,DISTRIBUTOR_URL" SearchType="Contains" ComparisonType=StringComparison.OrdinalIgnoreCase>
<asp:ControlParameter ControlID="txtSearchDistributor" />
</asp:SearchExpression>
https://msdn.microsoft.com/en-us/library/system.stringcomparison%28v=vs.110%29.aspx
根据 documentation:
Case sensitivity in the search expression depends on the LINQ provider that you specify in the QueryExtender control.
If the LINQ provider that you use in the QueryExtender control supports case sensitivity, you can use the ComparisonType property to enable or ignore case sensitivity.
另一种可能性 - 数据库整理
可能您的数据库设置为区分大小写。如果您使用的是 SQL 服务器的一些链接。
我在三个字段的文本框中应用了查询扩展器。它可以工作,但区分大小写。例如如果用户名字段的名称为 "AWAIS" 而我搜索 "awais" ,它不会搜索,反之亦然。我怎样才能消除敏感性?
我的代码是
<td>
<asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="BookStore.Bussines.Entities.BookStoreEntities"
OnSelecting="LinqDataSource1_Selecting">
</asp:LinqDataSource>
<asp:QueryExtender ID="qeSearch" runat="server" TargetControlID="LinqDataSource1">
<asp:SearchExpression DataFields="DISTRIBUTOR_NAME,DISTRIBUTOR_CODE,DISTRIBUTOR_URL" SearchType="Contains">
<asp:ControlParameter ControlID="txtSearchDistributor" />
</asp:SearchExpression>
</asp:QueryExtender>
</td>
如果您查看有关此控件的 MSDN 文档,您会了解如何处理区分大小写:
Case sensitivity in the search expression depends on the LINQ provider that you specify in the QueryExtender control.
试试这个:
将SearchExpression.ComparisonType
设置为StringComparison.OrdinalIgnoreCase
<asp:SearchExpression DataFields="DISTRIBUTOR_NAME,DISTRIBUTOR_CODE,DISTRIBUTOR_URL" SearchType="Contains" ComparisonType=StringComparison.OrdinalIgnoreCase>
<asp:ControlParameter ControlID="txtSearchDistributor" />
</asp:SearchExpression>
https://msdn.microsoft.com/en-us/library/system.stringcomparison%28v=vs.110%29.aspx
根据 documentation:
Case sensitivity in the search expression depends on the LINQ provider that you specify in the QueryExtender control.
If the LINQ provider that you use in the QueryExtender control supports case sensitivity, you can use the ComparisonType property to enable or ignore case sensitivity.
另一种可能性 - 数据库整理
可能您的数据库设置为区分大小写。如果您使用的是 SQL 服务器的一些链接。