Build a Custom MVC Search Box

Posted by sfdev on 24-Jun-2019 14:37

Hi,

I need a custom MVC Search Box and have been using code provided at https://github.com/Sitefinity/feather-widgets/tree/master/Telerik.Sitefinity.Frontend.Search/Mvc to generate an external assembly. I encountered the error below  when I tried to compile:

1>C:\Users\user\source\repos\SearchBox\SearchBox\Mvc\Controllers\SearchBoxController.cs(11,42,11,55): error CS0234: The type or namespace name 'Configuration' does not exist in the namespace 'Telerik.Sitefinity.Services.Search' (are you missing an assembly reference?)

I am using .NET 4.5 and Sitefinity version 10.2.6602.0. Any advice? 

Thanks in advance!

All Replies

Posted by linotadros on 24-Jun-2019 19:04

From your external assembly project in Visual Studio, make sure all the following using statements have a corresponding assembly available in the BIN folder of your project

using System;
using System.Collections.Generic;
using System.Web.Mvc;
using Telerik.Sitefinity.Frontend.Search.Mvc.StringResources;
using Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Controllers.Attributes;
using Telerik.Sitefinity.Mvc;
using Telerik.Sitefinity.Frontend.Search.Mvc.Models;
using Telerik.Sitefinity.Frontend.Mvc.Infrastructure.Controllers;
using System.ComponentModel;
using Telerik.Sitefinity.Configuration;
using Telerik.Sitefinity.Services.Search.Configuration;
using Telerik.Sitefinity.Services;
using System.Globalization;
using Telerik.Sitefinity.Web.UI;
using Telerik.Sitefinity.Localization;
using Telerik.Sitefinity.Web;
using Telerik.Sitefinity.Abstractions;
using Telerik.Sitefinity.Services.Search;



I am pretty sure you do not have the Telerik.Sitefinity.Search.impl.dll referenced in your bin folder

Posted by sfdev on 25-Jun-2019 15:06

Hi,

Thanks linotadros! I managed to build without errors. After registering the dll, it seems to clash with the original search box widget.

a) Both are unable to detect any of the search index I created

b) Both only works if I register the search index manually (entering the SearchIndexPipeId) through the widgets' advanced option

c) Custom Search Box's button is greyed out in design mode

Here are the pictures of the errors:

I ended up setting designerview-simple.js, sf-search-box.min.css and Search-box.js files to embedded resources. Then, both widgets will work fine!


But, I suspect this is not the right way to create external dll. What should I do to make the original search widget not affected by my external dll widget?

This thread is closed