Offcourse i appreciate your help.
And i gave the new repeater the ID ltlRepeaterCount
This is the code from: qeuryrepeater_2
using System;
using System.Data;
using System.Web;
using System.Web.UI;
using CMS.Controls;
using CMS.GlobalHelper;
using CMS.PortalControls;
public partial class CMSWebParts_Viewers_Query_queryrepeater_2 : CMSAbstractWebPart
{
#region "Document properties"
/// <summary>
/// Load pages individually.
/// </summary>
public bool LoadPagesIndividually
{
get
{
return ValidationHelper.GetBoolean(GetValue("LoadPagesIndividually"), false);
}
set
{
SetValue("LoadPagesIndividually", value);
}
}
/// <summary>
/// Gets or sets the cache item name.
/// </summary>
public override string CacheItemName
{
get
{
return base.CacheItemName;
}
set
{
base.CacheItemName = value;
repItems.CacheItemName = value;
}
}
/// <summary>
/// Cache dependencies, each cache dependency on a new line.
/// </summary>
public override string CacheDependencies
{
get
{
return ValidationHelper.GetString(base.CacheDependencies, repItems.CacheDependencies);
}
set
{
base.CacheDependencies = value;
repItems.CacheDependencies = value;
}
}
/// <summary>
/// Gets or sets the cache minutes.
/// </summary>
public override int CacheMinutes
{
get
{
return base.CacheMinutes;
}
set
{
base.CacheMinutes = value;
repItems.CacheMinutes = value;
}
}
/// <summary>
/// Gets or sets the order by clause.
/// </summary>
public string OrderBy
{
get
{
return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("OrderBy"), repItems.OrderBy), repItems.OrderBy);
}
set
{
SetValue("OrderBy", value);
repItems.OrderBy = value;
}
}
/// <summary>
/// Gets or sets the where condition.
/// </summary>
public string WhereCondition
{
get
{
return DataHelper.GetNotEmpty(GetValue("WhereCondition"), repItems.WhereCondition);
}
set
{
SetValue("WhereCondition", value);
repItems.WhereCondition = value;
}
}
/// <summary>
/// Gets or sets the number which indicates how many documents should be displayed.
/// </summary>
public int SelectTopN
{
get
{
return ValidationHelper.GetInteger(GetValue("SelectTopN"), repItems.SelectTopN);
}
set
{
SetValue("SelectTopN", value);
repItems.SelectTopN = value;
}
}
#endregion
#region "Pager properties"
/// <summary>
/// Gets or sets the value that indicates whether paging is enabled.
/// </summary>
public bool EnablePaging
{
get
{
return ValidationHelper.GetBoolean(GetValue("EnablePaging"), repItems.EnablePaging);
}
set
{
SetValue("EnablePaging", value);
repItems.EnablePaging = value;
}
}
/// <summary>
/// Gets or sets the pager position.
/// </summary>
public PagingPlaceTypeEnum PagerPosition
{
get
{
return repItems.PagerControl.GetPagerPosition(DataHelper.GetNotEmpty(GetValue("PagerPosition"), repItems.PagerControl.PagerPosition.ToString()));
}
set
{
SetValue("PagerPosition", value.ToString());
repItems.PagerControl.PagerPosition = value;
}
}
/// <summary>
/// Gets or sets the number of the documents displayed on each sigle page.
/// </summary>
public int PageSize
{
get
{
return ValidationHelper.GetInteger(GetValue("PageSize"), repItems.PageSize);
}
set
{
SetValue("PageSize", value);
repItems.PageSize = value;
}
}
/// <summary>
/// Gets or sets the pager query string key.
/// </summary>
public string QueryStringKey
{
get
{
return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("QueryStringKey"), repItems.PagerControl.QueryStringKey), repItems.PagerControl.QueryStringKey);
}
set
{
SetValue("QueryStringKey", value);
repItems.PagerControl.QueryStringKey = value;
}
}
/// <summary>
/// Gets or sets whether PostBack or QueryString should be used for the paging.
/// </summary>
public PagingModeTypeEnum PagingMode
{
get
{
return repItems.PagerControl.GetPagingMode(DataHelper.GetNotEmpty(GetValue("PagingMode"), repItems.PagerControl.PagingMode.ToString()));
}
set
{
SetValue("PagingMode", value.ToString());
repItems.PagerControl.PagingMode = value;
}
}
/// <summary>
/// Gets or sets the navigation mode.
/// </summary>
public BackNextLocationTypeEnum BackNextLocation
{
get
{
return repItems.PagerControl.GetBackNextLocation(DataHelper.GetNotEmpty(GetValue("BackNextLocation"), repItems.PagerControl.BackNextLocation.ToString()));
}
set
{
SetValue("BackNextLocation", value.ToString());
repItems.PagerControl.BackNextLocation = value;
}
}
/// <summary>
/// Gets or sets the value that indicates whether first and last page is shown if paging is allowed.
/// </summary>
public bool ShowFirstLast
{
get
{
return ValidationHelper.GetBoolean(GetValue("ShowFirstLast"), repItems.PagerControl.ShowFirstLast);
}
set
{
SetValue("ShowFirstLast", value);
repItems.PagerControl.ShowFirstLast = value;
}
}
/// <summary>
/// Gets or sets the html before pager.
/// </summary>
public string PagerHTMLBefore
{
get
{
return ValidationHelper.GetString(GetValue("PagerHTMLBefore"), repItems.PagerControl.PagerHTMLBefore);
}
set
{
SetValue("PagerHTMLBefore", value);
repItems.PagerControl.PagerHTMLBefore = value;
}
}
/// <summary>
/// Gets or sets the html after pager.
/// </summary>
public string PagerHTMLAfter
{
get
{
return ValidationHelper.GetString(GetValue("PagerHTMLAfter"), repItems.PagerControl.PagerHTMLAfter);
}
set
{
SetValue("PagerHTMLAfter", value);
repItems.PagerControl.PagerHTMLAfter = value;
}
}
/// <summary>
/// Gets or sets the results position.
/// </summary>
public ResultsLocationTypeEnum ResultsPosition
{
get
{
return repItems.PagerControl.GetResultPosition(ValidationHelper.GetString(GetValue("ResultsPosition"), ""));
}
set
{
SetValue("ResultsPosition", value);
repItems.PagerControl.ResultsLocation = value;
}
}
/// <summary>
/// Gets or sets the page numbers separator.
/// </summary>
public string PageNumbersSeparator
{
get
{
return ValidationHelper.GetString(GetValue("PageNumbersSeparator"), repItems.PagerControl.PageNumbersSeparator);
}
set
{
SetValue("PageNumbersSeparator", value);
repItems.PagerControl.PageNumbersSeparator = value;
}
}
#endregion
#region "Public properties"
/// <summary>
/// Gets or sets the value that indicates whether control should be hidden if no data found.
/// </summary>
public bool HideControlForZeroRows
{
get
{
return ValidationHelper.GetBoolean(GetValue("HideControlForZeroRows"), repItems.HideControlForZeroRows);
}
set
{
SetValue("HideControlForZeroRows", value);
repItems.HideControlForZeroRows = value;
}
}
/// <summary>
/// Gets or sets the text which is displayed for zero rows result.
/// </summary>
public string ZeroRowsText
{
get
{
return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("ZeroRowsText"), repItems.ZeroRowsText), repItems.ZeroRowsText);
}
set
{
SetValue("ZeroRowsText", value);
repItems.ZeroRowsText = value;
}
}
/// <summary>
/// Gets or sets the separator (tetx, html code) which is displayed between displayed items.
/// </summary>
public string ItemSeparator
{
get
{
return DataHelper.GetNotEmpty(GetValue("ItemSeparator"), repItems.ItemSeparator);
}
set
{
SetValue("ItemSeparator", value);
repItems.ItemSeparator = value;
}
}
/// <summary>
/// Filter name.
/// </summary>
public string FilterName
{
get
{
return ValidationHelper.GetString(GetValue("FilterName"), repItems.FilterName);
}
set
{
SetValue("FilterName", value);
repItems.FilterName = value;
}
}
/// <summary>
/// Gets or sets query string key name. Presence of the key in query string indicates,
/// that some item should be selected. The item is determined by query string value.
/// </summary>
public string SelectedQueryStringKeyName
{
get
{
return ValidationHelper.GetString(GetValue("SelectedQueryStringKeyName"), repItems.SelectedQueryStringKeyName);
}
set
{
SetValue("SelectedQueryStringKeyName", value);
repItems.SelectedQueryStringKeyName = value;
}
}
/// <summary>
/// Gets or sets columns name by which the item is selected.
/// </summary>
public string SelectedDatabaseColumnName
{
get
{
return ValidationHelper.GetString(GetValue("SelectedDatabaseColumnName"), repItems.SelectedDatabaseColumnName);
}
set
{
SetValue("SelectedDatabaseColumnName", value);
repItems.SelectedDatabaseColumnName = value;
}
}
/// <summary>
/// Gets or sets validation type for query string value which determines selected item.
/// Options are int, guid and string.
/// </summary>
public string SelectedValidationType
{
get
{
return ValidationHelper.GetString(GetValue("SelectedValidationType"), repItems.SelectedValidationType);
}
set
{
SetValue("SelectedValidationType", value);
repItems.SelectedValidationType = value;
}
}
#endregion
#region "Data binding properties"
/// <summary>
/// Gets or sets the value that indicates whether databind will be proceeded automatically.
/// </summary>
public bool DataBindByDefault
{
get
{
return ValidationHelper.GetBoolean(GetValue("DataBindByDefault"), repItems.DataBindByDefault);
}
set
{
SetValue("DataBindByDefault", value);
repItems.DataBindByDefault = value;
}
}
/// <summary>
/// Gets or sets the query name.
/// </summary>
public string QueryName
{
get
{
return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("QueryName"), repItems.QueryName), repItems.QueryName);
}
set
{
SetValue("QueryName", value);
repItems.QueryName = value;
}
}
/// <summary>
/// Gets or sets selected columns.
/// </summary>
public string Columns
{
get
{
return ValidationHelper.GetString(GetValue("Columns"), repItems.Columns);
}
set
{
SetValue("Columns", value);
repItems.SelectedColumns = value;
}
}
#endregion
#region "Transformation properties"
/// <summary>
/// Gets or sets the name of the transforamtion which is used for displaying the results.
/// </summary>
public string TransformationName
{
get
{
return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("TransformationName"), repItems.TransformationName), repItems.TransformationName);
}
set
{
SetValue("TransformationName", value);
repItems.TransformationName = value;
}
}
/// <summary>
/// Gets or sets the name of the transforamtion which is used for displaying the alternate results.
/// </summary>
public string AlternatingTransformationName
{
get
{
return DataHelper.GetNotEmpty(ValidationHelper.GetString(GetValue("AlternatingTransformationName"), repItems.AlternatingTransformationName), repItems.AlternatingTransformationName);
}
set
{
SetValue("AlternatingTransformationName", value);
repItems.AlternatingTransformationName = value;
}
}
/// <summary>
/// Gets or sets ItemTemplate for selected item.
/// </summary>
public string SelectedItemTransformationName
{
get
{
return ValidationHelper.GetString(GetValue("SelectedItemTransformationName"), "");
}
set
{
SetValue("SelectedItemTransformationName", value);
repItems.SelectedItemTransformationName = value;
}
}
#endregion
#region "Editing mode buttons properties"
/// <summary>
/// Gets or sets the value that indicates whether edit and delete buttons should be displayed.
/// </summary>
public bool ShowEditDeleteButtons
{
get
{
return ValidationHelper.GetBoolean(GetValue("ShowEditDeleteButtons"), repItems.ShowEditDeleteButtons);
}
set
{
SetValue("ShowEditDeleteButtons", value);
repItems.ShowEditDeleteButtons = value;
}
}
#endregion
#region "Stop processing"
/// <summary>
/// Returns true if the control processing should be stopped.
/// </summary>
public override bool StopProcessing
{
get
{
return base.StopProcessing;
}
set
{
base.StopProcessing = value;
repItems.StopProcessing = value;
}
}
#endregion
/// <summary>
/// Content loaded event handler.
/// </summary>
public override void OnContentLoaded()
{
base.OnContentLoaded();
SetupControl();
this.repItems.DataBinding += new EventHandler(repItems_DataBinding);
}
void repItems_DataBinding(object sender, EventArgs e)
{
if (!CMS.GlobalHelper.DataHelper.DataSourceIsEmpty(repItems.DataSource))
{
System.Data.DataView dv = repItems.DataSource as System.Data.DataView;
if ((dv != null) && (dv.Table != null))
{
ltlRepeaterCount.Text = dv.Table.Rows.Count.ToString();
}
}
}
/// <summary>
/// Initializes the control properties.
/// </summary>
protected void SetupControl()
{
if (StopProcessing)
{
repItems.StopProcessing = true;
}
else
{
// Add query repeater to the filter collection
CMSControlsHelper.SetFilter(ValidationHelper.GetString(GetValue("WebPartControlID"), ClientID), repItems);
// Setup the control
repItems.ControlContext = ControlContext;
// Document properties
repItems.LoadPagesIndividually = LoadPagesIndividually;
repItems.CacheItemName = CacheItemName;
repItems.CacheDependencies = CacheDependencies;
repItems.CacheMinutes = CacheMinutes;
repItems.OrderBy = OrderBy;
repItems.SelectTopN = SelectTopN;
repItems.WhereCondition = WhereCondition;
repItems.ItemSeparator = ItemSeparator;
repItems.FilterName = FilterName;
repItems.SelectedQueryStringKeyName = SelectedQueryStringKeyName;
repItems.SelectedDatabaseColumnName = SelectedDatabaseColumnName;
repItems.SelectedValidationType = SelectedValidationType;
// Pager
repItems.EnablePaging = EnablePaging;
repItems.PageSize = PageSize;
repItems.PagerControl.PagerPosition = PagerPosition;
repItems.PagerControl.QueryStringKey = QueryStringKey;
repItems.PagerControl.PagingMode = PagingMode;
repItems.PagerControl.BackNextLocation = BackNextLocation;
repItems.PagerControl.ShowFirstLast = ShowFirstLast;
repItems.PagerControl.PagerHTMLBefore = PagerHTMLBefore;
repItems.PagerControl.PagerHTMLAfter = PagerHTMLAfter;
repItems.PagerControl.ResultsLocation = ResultsPosition;
repItems.PagerControl.PageNumbersSeparator = PageNumbersSeparator;
// Public
repItems.HideControlForZeroRows = HideControlForZeroRows;
repItems.ZeroRowsText = ZeroRowsText;
// Binding
repItems.DataBindByDefault = DataBindByDefault;
// Transformations
repItems.AlternatingTransformationName = AlternatingTransformationName;
repItems.TransformationName = TransformationName;
repItems.SelectedItemTransformationName = SelectedItemTransformationName;
repItems.QueryName = QueryName;
repItems.ShowEditDeleteButtons = ShowEditDeleteButtons;
repItems.Columns = Columns;
}
}
/// <summary>
/// OnPrerender override (Set visibility).
/// </summary>
protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
Visible = repItems.Visible && !StopProcessing;
if (DataHelper.DataSourceIsEmpty(repItems.DataSource) && repItems.HideControlForZeroRows)
{
Visible = false;
}
}
/// <summary>
/// Reloads the data.
/// </summary>
public override void ReloadData()
{
base.ReloadData();
SetupControl();
repItems.ReloadData(true);
}
/// <summary>
/// Clears cache.
/// </summary>
public override void ClearCache()
{
repItems.ClearCache();
}
}