Created
November 6, 2012 10:38
-
-
Save vgrem/4023950 to your computer and use it in GitHub Desktop.
SharePoint Custom Content Query Web Part (CQWP) For Arranging Items in Table Layout
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.ComponentModel; | |
using System.Security.Permissions; | |
using System.Web.UI.WebControls; | |
using System.Web.UI.WebControls.WebParts; | |
using Microsoft.SharePoint.Publishing.WebControls; | |
using Microsoft.SharePoint.Security; | |
using Microsoft.SharePoint.WebPartPages; | |
namespace CQWPWithTableLayout.WebControls | |
{ | |
[ToolboxItem(false)] | |
public class CBQTableLayout : ContentByQueryWebPart | |
{ | |
#region Control Lifecycle | |
protected override void CreateChildControls() | |
{ | |
try | |
{ | |
base.CreateChildControls(); | |
} | |
catch (Exception ex) | |
{ | |
throw; | |
} | |
} | |
protected override void ModifyXsltArgumentList(ArgumentClassWrapper argList) | |
{ | |
argList.AddParameter("RepeatDirection", string.Empty, RepeatDirection); | |
argList.AddParameter("RepeatColumns", string.Empty, RepeatColumns); | |
base.ModifyXsltArgumentList(argList); | |
} | |
/// <summary> | |
/// Return the tool panes that configure this <see cref="T:Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart"/> object.. | |
/// </summary> | |
[SharePointPermission(SecurityAction.Demand, ObjectModel = true)] | |
public override ToolPart[] GetToolParts() | |
{ | |
return new ToolPart[3] | |
{ | |
new ContentByQueryToolPart(), | |
new WebPartToolPart(), | |
new CBQTableLayoutToolPart() | |
}; | |
} | |
#endregion | |
#region Properties | |
[Category("TableLayout")] | |
[Personalizable(PersonalizationScope.Shared), DefaultValue(3), WebBrowsable(true)] | |
public int RepeatColumns { get; set; } | |
[Category("TableLayout")] | |
[Personalizable(PersonalizationScope.Shared), DefaultValue(RepeatDirection.Horizontal), WebBrowsable(true)] | |
public RepeatDirection RepeatDirection { get; set; } | |
#endregion | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment