SPView.GroupByHeader-Eigenschaft
Ruft ab oder legt die Definition der Group By-Header, die in der Ansicht verwendet.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaration
Public Property GroupByHeader As String
Get
Set
'Usage
Dim instance As SPView
Dim value As String
value = instance.GroupByHeader
instance.GroupByHeader = value
public string GroupByHeader { get; set; }
Eigenschaftswert
Typ: System.String
Eine Collaborative Application Markup Language (CAML) -Zeichenfolge, die die Definition der Header enthält.
Hinweise
Wenn Sie Werte über die GroupByHeader -Eigenschaft festlegen, müssen Sie die Methode Update für Änderungen in der Datenbank wirksam verwenden.
Beispiele
Das folgende Codebeispiel verwendet die GroupByHeader -Eigenschaft zum Anpassen der Schriftgröße, Schriftfarbe und Hintergrundfarbe des Kopfzeilenbereichs Group By in einer Ansicht innerhalb der aktuellen Websitesammlung einen angegebenen Standort.
Dim siteColl As SPSite = SPControl.GetContextSite(Context)
Dim site As SPWeb = siteColl.AllWebs("Site_Name")
Dim list As SPList = site.Lists("List_Name")
Dim view As SPView = list.Views("View_Name")
view.GroupByHeader = "<HTML><![CDATA[<TBODY id='titl]]></HTML>" _
& "<GetVar Name='GroupByLevelString' />" _
& "<HTML><![CDATA['><TR STYLE='font-size:14pt;color:red']]></HTML>"
_
& "<Switch><Expr><GetVar Name='GroupByIndent' /></Expr>
<Case Value='0'>" _
& "<HTML><![CDATA[ class='ms-gb' ]]></HTML></Case><Default>" _
& "<HTML><![CDATA[ class='ms-gb2' ]]></HTML></Default></Switch>" _
& "<HTML><![CDATA[><TD colspan='100' nowrap BGCOLOR='white'>" _
& "<img src='/_layouts/images/blank.gif' alt='' height=1 width=]]>"
_
& "</HTML><GetVar Name='GroupByIndent' />" _
& "<HTML><![CDATA[><a href='javascript:'
onclick='javascript:ExpCollGroup(']]></HTML>" _
& "<GetVar Name='GroupByLevelString' />
<HTML><![CDATA[','img_]]></HTML>" _
& "<GetVar Name='GroupByLevelString' />
<HTML><![CDATA[');return false;'><img id='img_]]></HTML>" _
& "<GetVar Name='GroupByLevelString' />
<HTML><![CDATA[' src='/_layouts/images/minus.gif'
alt=']]></HTML>" _
& "<HTML>Expand/Collapse</HTML>
<HTML><![CDATA[' border='0'></a>&nbsp;]]></HTML>" _
& "<GetVar Name='GroupByField' HTMLEncode='TRUE' />
<HTML><![CDATA[ :&nbsp;]]></HTML>" _
& "<GetVar Name='GroupByValue' />
<HTML><![CDATA[</TD></TR></TBODY>]]></HTML>" _
& "<HTML><![CDATA[<TBODY id='tbod]]></HTML>
<GetVar Name='GroupByLevelString' HTMLEncode='TRUE' />" _
& "<HTML><![CDATA[_'>]]></HTML><SetVar Name='EvenRow'
Scope='Request' Value='0' />" _
& "<SetVar Name='OnlyOneItem' Scope='Request' Value='1' />"
view.Update()
SPSite oSiteCollection = SPContext.Current.Site;
using(SPWeb oWebsite = oSiteCollection.AllWebs["Website_Name"])
{
SPList oList = oWebsite.Lists["List_Name"];
SPView oView = oList.Views["View_Name"];
oView.GroupByHeader =
"<HTML><![CDATA[<TBODY id=\"titl]]></HTML>" +
"<GetVar Name=\"GroupByLevelString\" />" +
"<HTML><![CDATA[\"><TR STYLE=\"font-size:14pt;color:red\"]]></HTML>"
+
"<Switch><Expr><GetVar Name=\"GroupByIndent\" /></Expr>
<Case Value=\"0\">" +
"<HTML><![CDATA[ class=\"ms-gb\" ]]></HTML></Case><Default>" +
"<HTML><![CDATA[ class=\"ms-gb2\" ]]></HTML></Default></Switch>" +
"<HTML><![CDATA[><TD colspan=\"100\" nowrap BGCOLOR=\"white\">" +
"<img src=\"/_layouts/images/blank.gif\" alt=\"\" height=1
width=]]>" +
"</HTML><GetVar Name=\"GroupByIndent\" />" +
"<HTML><![CDATA[><a href=\"javascript:\"
onclick=\"javascript:ExpCollGroup(']]></HTML>" +
"<GetVar Name=\"GroupByLevelString\" />
<HTML><![CDATA[','img_]]></HTML>" +
"<GetVar Name=\"GroupByLevelString\" />
<HTML><![CDATA[');return false;\"><img id=\"img_]]></HTML>" +
"<GetVar Name=\"GroupByLevelString\" />
<HTML><![CDATA[\" src=\"/_layouts/images/minus.gif\"
alt=\"]]></HTML>" +
"<HTML>Expand/Collapse</HTML>
<HTML><![CDATA[\" border=\"0\"></a> ]]></HTML>" +
"<GetVar Name=\"GroupByField\" HTMLEncode=\"TRUE\" />
<HTML><![CDATA[ : ]]></HTML>" +
"<GetVar Name=\"GroupByValue\" />
<HTML><![CDATA[</TD></TR></TBODY>]]></HTML>" +
"<HTML><![CDATA[<TBODY id=\"tbod]]></HTML>
<GetVar Name=\"GroupByLevelString\" HTMLEncode=\"TRUE\" />" +
"<HTML><![CDATA[_\">]]></HTML><SetVar Name=\"EvenRow\"
Scope=\"Request\" Value=\"0\" />" +
"<SetVar Name=\"OnlyOneItem\" Scope=\"Request\" Value=\"1\" />";
oView.Update();
}
Hinweis
Bestimmte Objekte, die IDisposable -Schnittstelle implementieren, und müssen Sie vermeiden, diese Objekte im Arbeitsspeicher beibehalten, nachdem sie nicht mehr benötigt werden. Informationen zu bewährten Programmierpraktiken finden Sie unter Disposing Objects.