Regarding Smart Search Filter and Result using AJAX

Ashish Narnoli asked on March 12, 2014 04:45

Hi,

As per custom requirement, i cloned the Smartsearch filter, Dialog and Result webparts and put/ remove some custom code which is not required for my functionality to accomplish this task.

I have Smart Search filter tree structure and a Smartsearch results webpart. Now, when i click on filter leaf, it updated the searchtext Querystring on url and the results are displaying by using that searchtext Querystring value. This is working fine.

BUT as the user clicks on filter leaf, the Postback occurs and then the result is displaying.

My question is, what method i should follow in this scenario to get rid of Postback? I tried using turning the Update panel On for the entire web part zone in which these web parts are placed but it doesn't work.

Suggestions are highly appreciated.

Best Regards! Ashish Narnoli

Correct Answer

Roman Koníček answered on March 26, 2014 05:38

Hi,

As for your first question, you can use cookie/session values instead of query string parameters. There should not be any problem with this approach. I would just recommend you to create a new customized web part, which would be the clone of default smart search web part, instead of modifying the default one. So you can be sure that your code will not be overridden during the upgrade.

As for the avoiding a postback, I have inserted code below into my page template layout to test if there is a postback or not:

<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
   if (!IsPostBack)
   {
       Response.Write("there is no postback");
   }
} 
</script>

Then I have enabled the update panel for web part zone and there was no postback on page -> I could see the text "there is no postback" text all the time. So I guess that would be matter of your custom code.

Best Regards, Roman Konicek

0 votesVote for this answer Unmark Correct answer

Recent Answers


Ashish Narnoli answered on March 19, 2014 00:31

Hi, Still awaiting for response :)

Regards! Ashish Narnoli

0 votesVote for this answer Mark as a Correct answer

Ashish Narnoli answered on March 24, 2014 04:06

Hello all,

It seems that it needs to refine my question. So, i again brief my questions:

I am working to implement Smart search module for searching purpose.

For doing this, i slightly changed the Smartsearch filter, Dialog and Result webparts and added some custom code.

As i have seen, the Smartsearch result is working on QueryString paramater values.

My question is - "If i use cookie/ session values for displaying results instead of using Query string parameters, then will it affect other module like Online Marketing or something else? Using cookie is feasible with Smart search filter and result or not?"

I want to use this approach because "In default implementation of Smart search filter, as the user clicks on Search Filter, it updated the Query string and Postback occurs and results are displaying fine. In order to avoid Postback, i have tried Update panel ON for the entire web part zone in which Smart search Filter and Result web parts are placed, but unfortunately it FAILS to avoid Postback?"

I am using Kentico EMS v7.0.37

Kindly give some guideline to resolve this issue.

Thanks in advance. :)

Best Regards! Ashish Narnoli

0 votesVote for this answer Mark as a Correct answer

Ashish Narnoli answered on March 27, 2014 00:32

Hi Roman,

Thank you so much for your response.

As per your suggestion, i cloned the existing web part and started working with Cookie. In my current scenario, by using Cookie there is no need to check with postback.

Again thanks a lot for you valuable suggestion.

Best Regards!

Ashish Narnoli

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.