Ok I think It will be better if I show code and write what I intended to do. Here is aspx code:
<%@ Control Language="C#" AutoEventWireup="true" Inherits="something" CodeFile="~path.ascx.cs" %>
<cms:CMSDocumentsDataSource ID="DocumentData" runat="server" Path="./%" EnableSelectedItem="true"/>
<ul runat="server" id="UnorderList" ClientIDMode="Static">
<cms:CMSRepeater runat="server" ID="DocumentRepeater" DataSourceName="DocumentData"</cms:CMSRepeater>
</ul>
As you can see we have here two controls: Document Data Source and Basic Repeater. The Point is to combine this two controls that Basic Repeater display documents stored in Document Data Source. The default Path for Document Data Source is "./%" which means that documents will be under page on which this web part will be put. The rest is in code behind:
using System;
using System.Data;
using System.Collections;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CMS.PortalControls;
using CMS.GlobalHelper;
using CMS.CMSHelper;
public partial class something : CMSAbstractWebPart
{
#region "Properties"
private readonly string Path = "Path";
private readonly string Transformation = "Transformation";
private readonly string SelectedTransformation = "SelectedTransformation";
private readonly string DocumentType = "DocumentType";
private readonly string ColumnsNumber = "ColumnsNumber";
#endregion
#region "Methods"
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
}
public override void OnContentLoaded()
{
base.OnContentLoaded();
SetupControl();
}
protected void SetupControl()
{
if (this.StopProcessing)
{
// Do not process
}
else
{
UnorderList.Attributes.Add("Class", this.GetValue(ColumnsNumber).ToString());
DocumentData.Path = this.GetValue(Path).ToString();
DocumentData.ClassNames = this.GetValue(DocumentType).ToString();
DocumentRepeater.DataSource = DocumentData.DataSource;
DocumentRepeater.TransformationName = this.GetValue(Transformation).ToString();
DocumentRepeater.SelectedItemTransformationName=this.GetValue(SelectedTransformation).ToString()
DocumentRepeater.DataBind();
}
}
public override void ReloadData()
{
base.ReloadData();
SetupControl();
}
#endregion
}
In #region "properties" there are some privat readonly strings. I'm using them as web part properties wchih are filled out by user via Form Controls. Nothing interesting here.
The place which is interesting is
DocumentRepeater.SelectedItemTransformationName=this.GetValue(SelectedTransformation).ToString()
Data Base stores column named SelectedTransformation and filled out by user via form control called Transformation Selector. We can put there for example "Custom.Document.Default". It seems that after write to browser document url this document should be display by Default Transformatin. But it is display by transformation from DocumentRepeater.TransformationName. What should I do?