【发布时间】:2011-01-15 02:38:21
【问题描述】:
我有一个 SPGridView,它通过过滤显示列表中的项目。
列表有一些查找字段。 在我的 SPGridview 中,查找字段的过滤器值以这种格式显示:
{id};#{Value}
这使得过滤器不起作用,因为它只期望没有 {id} 的值;#
有没有办法在没有 {id};# 部分的情况下显示过滤器值?
谢谢
【问题讨论】:
标签: sharepoint
我有一个 SPGridView,它通过过滤显示列表中的项目。
列表有一些查找字段。 在我的 SPGridview 中,查找字段的过滤器值以这种格式显示:
{id};#{Value}
这使得过滤器不起作用,因为它只期望没有 {id} 的值;#
有没有办法在没有 {id};# 部分的情况下显示过滤器值?
谢谢
【问题讨论】:
标签: sharepoint
我是这样解决这个问题的:
<asp:TemplateField HeaderText="Campaign Members">
<ItemTemplate>
<%# RemoveCharacters(Eval("CampaignMembers").ToString())%>
</ItemTemplate>
</asp:TemplateField>
// Make sure declare using System.Text.RegularExpression; protected string
RemoveCharacters(object String)
{
string s1 = String.ToString();
string newString = Regex.Replace(s1, @"#[\d-];", string.Empty);
newString = Regex.Replace(newString, "#", " ");
return newString.ToString();
}
【讨论】:
尝试将 FilteredDataSourcePropertyFormat 属性设置为
"({1} LIKE '{0}') OR ({1} LIKE '{0};%') OR ({1} LIKE '%;#{0}') OR ({1} LIKE '%;#{0};%')"
【讨论】:
为 SPGridView 生成列时,请使用 SPBoundField,而不是 BoundField。
【讨论】: