Portal Engine Questions on portal engine and web parts.
Version 6.x > Portal Engine > Get item count of query repeater View modes: 
User avatar
Certified Developer v6
Certified Developer v6
j.hoppe-thehealthedgroup - 7/2/2012 11:10:24 AM
   
Get item count of query repeater
I have a repeater with custom query within my own custom web part. I want to implement some logic in the code behind of my custom web part, that is dependent on whether or not the query repeater returned data. How can I get the item count from the query repeater?


<%@ Register Src="../../CMSWebParts/Viewers/Query/queryrepeater.ascx" TagName="queryrepeater"
TagPrefix="uc2" %>
<uc2:queryrepeater runat="server" EnableViewState="False" ID="QrptWebinars" TransformationName="custom.Webinar.MainTout"
WhereCondition="WebinarID IN (SELECT DISTINCT [WebinarID] FROM [customtable_WebinarRegistrants] WHERE RegistrantUserID = 82) AND NewsPublished = 1 AND WebinarPublished = 1"
QueryName="custom.SurroundHealth.NewsEvents_Webinars" OrderBy="WebinarStart" />


I.e., I want to be able to reference something like QrptWebinars.Items.Count.

User avatar
Member
Member
kentico_alleng - 7/5/2012 2:54:46 PM
   
RE:Get item count of query repeater
You can get the current index with: <%# DataItemIndex %>

And you can retrieve the total number of items using: <%# DataRowView.DataView.Count %>

Regards,

Allen