Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Customize Module for search images

Vote:
 

Hi,

I need to customize my "Search Images" module in Customize Community -> Moderation -> Media -> Images -> Search Images tab   adding a new search field.

My Images have some Predefined tags and what I want to do is to search them by this tags

I have already added the new field in SearchImageControl.ascx but I can not find how/where to add the codebehind code.

Any suggestions?

Thanks

#115403
Jan 14, 2015 15:04
Vote:
 

Hi guys, 

I was able to add new fields under [Community] -> [Moderation Mode] -> [search images] extending the class "SearchImageControl.ascx" and "ImageListControl.ascx".

The search works properly but I have a wrong pagination. 

It seems that the dataListImages (the default EPiServer dataList that cointains the Images) always have the same size before my filter.

So, I find the correct results, with only images that match whit my filter, but with a wrong pagination.

Below my code for "ImageListControlExtension.cs" :

protected override void OnPreRender(EventArgs e)
{
ImageCollection imgCollect;

if (!string.IsNullOrEmpty(ExtendedImagesModule.imgStatus) && !ExtendedImagesModule.imgStatus.Equals("---"))
{ 
imgCollect = ((EPiServer.Community.ImageGallery.ImageCollection)(dataListImages.DataSource)); 
imgCollect= search(imgCollect);   // Return a filtered ImageCollection

dataListImages.DataSource = imgCollect; // Reassign a new datasource to the default dataListImages (that show the images list)
dataListImages.DataBind();
}
base.OnPreRender(e);
}

Any idea what could be causing this?

Thanks.

#116058
Jan 22, 2015 12:24
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.