我有一个SPGridView显示列表中的项目与筛选。Sharepoint SPGridView过滤查找字段
该列表有一些lookupfields。 我SPGridview一个lookupfield的过滤器值显示格式为:
{id};#{Value}
这使得过滤器无法工作,因为它只是没有{ID}期待值;#
是有办法显示没有{id};#部分的过滤器值?
感谢
我有一个SPGridView显示列表中的项目与筛选。Sharepoint SPGridView过滤查找字段
该列表有一些lookupfields。 我SPGridview一个lookupfield的过滤器值显示格式为:
{id};#{Value}
这使得过滤器无法工作,因为它只是没有{ID}期待值;#
是有办法显示没有{id};#部分的过滤器值?
感谢
这是我如何解决这个问题:
<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();
}
当你生成SPGridView列,使用SPBoundField,不绑定列。
尝试FilteredDataSourcePropertyFormat属性设置为
"({1} LIKE '{0}') OR ({1} LIKE '{0};%') OR ({1} LIKE '%;#{0}') OR ({1} LIKE '%;#{0};%')"