SPView.GroupByHeader property
Obtém ou define a definição do grupo por cabeçalho usado no modo de exibição.
Namespace: Microsoft.SharePoint
Assembly: Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Syntax
'Declaração
Public Property GroupByHeader As String
Get
Set
'Uso
Dim instance As SPView
Dim value As String
value = instance.GroupByHeader
instance.GroupByHeader = value
public string GroupByHeader { get; set; }
Property value
Type: System.String
Uma seqüência de caracteres de Marcação idioma CAML (Collaborative Application) que contém a definição de cabeçalho.
Comentários
Se você definir valores através da propriedade GroupByHeader , você deve usar o método Update para que as alterações tenham efeito no banco de dados.
Examples
O exemplo de código a seguir usa a propriedade GroupByHeader para personalizar o tamanho da fonte, a cor da fonte e a cor de plano de fundo da área de cabeçalho Group By no modo de exibição dentro de um site especificado do conjunto de sites atual.
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();
}
Dica
Determinados objetos implementam a interface IDisposable , e você deve evitar reter esses objetos na memória depois que eles não são mais necessários. Para obter informações sobre boas práticas de codificação, consulte Disposing Objects.