我有一個SPGridView,顯示列表中的項目(使用spboundfield)。用於查找字段的Gridview顯示
該列表有一些lookupfields。和多查找的Fileds我SPGridview一個lookupfield的過濾器值顯示格式爲:
{ID};#{值}
什麼我的選擇是現在嗎?
我有一個SPGridView,顯示列表中的項目(使用spboundfield)。用於查找字段的Gridview顯示
該列表有一些lookupfields。和多查找的Fileds我SPGridview一個lookupfield的過濾器值顯示格式爲:
{ID};#{值}
什麼我的選擇是現在嗎?
爲模板字段創建一個自定義模板類,在該模板類中列出您的列表時重新設置查詢字段的格式,最簡單的方法當然是SPField類的GetValueAsHtml。 這是關於通用模板的一個很好的教程:http://www.developer.com/article.php/3609991
您可以使用dataviewwebpart類代替spgridview來實現此目的。使用xslt你可以訪問大量的圖書館帽子可以幫助你進行格式化。馬克d。 Anderson在codeplex上有一個很好的xslt函數庫,名爲sharepoint xslt模板。
http://sympmarc.com/2010/04/22/new-codeplex-project-sharepoint-xsl-templates-spxslt/
我正在嘗試從Dataview wp移開,因爲它與排序有關。 dvwp只對顯示的項目進行排序,而不是對整個數據集進行排序。 – 2010-11-29 04:55:04
這是我如何解決這個問題:
<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
,而不是BoundField
!
有沒有辦法使用string.replace函數來解決這個問題? – 2010-11-28 20:05:53