我有一個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};%')"