ASPX templates
Version 5.x > ASPX templates > cmssearchresults web part View modes: 
User avatar
Member
Member
vino-fsm - 1/18/2010 12:39:48 AM
   
cmssearchresults web part
Hi,

How do I get the total items of a search results? I need to display something like
"Your search of KEYWORD returned 50 results".

i.e mySeachResults.Items.Count?

cheers
vino

User avatar
Member
Member
vino-fsm - 1/19/2010 4:41:23 PM
   
RE:cmssearchresults web part
Anyone has an easy solution for this? Or do I have to write custom search provider just to get the total items in the result.

User avatar
Kentico Developer
Kentico Developer
kentico_helenag - 1/20/2010 2:30:01 PM
   
RE:cmssearchresults web part
Hello,

if you use the smart search you may use the Eval function in transformation: <%# Eval("Pages") %>.

If you use the SQL search you may use code like this:

protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
if (srchResults.DataSource != null)
ltlRepeaterCount.Text = srchResults.DataSource.Tables[0].Rows.Count.ToString();

}


It needs to add the literal control with ltlRepeaterCount ID to template.


Best regards,
Helena Grulichova

User avatar
Member
Member
vino-fsm - 1/20/2010 4:57:23 PM
   
RE:cmssearchresults web part
awesome.

thanks much.
cheers