Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello Code Project,

I'm using Google Custom Search (GCS) in my application. I have created separate page named "GoogleCustomSearch" for that, and its indeed working fine..

But my question is, how can I search from the Master Page using this GCS?

Thanking you in advance :)


Okay so my code is being concerned so far, here I have also posted the code:

//this code is under HEAD section
XML
<script>
    (function() {
    var cx = '015345991604875741939:aau25ao69wm';
        var gcse = document.createElement('script'); gcse.type = 'text/javascript'; gcse.async = true;
        gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
        '//www.google.com/cse/cse.js?cx=' + cx;
        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(gcse, s);
    })();

</script>


// this code is on Result page
<gcse:search></gcse:search>


So here I am able to perform search from result page, though I have put my code on master page I am not able to get the result on Result page....
Posted
Updated 26-Oct-12 5:41am
v2
Comments
bbirajdar 25-Oct-12 11:20am    
Place the GCS code on master page...
[no name] 26-Oct-12 0:45am    
Ya I have tried that out as well. But I am not able to redirect to another page, which should show me results...
Sergey Alexandrovich Kryukov 25-Oct-12 14:41pm    
What do you mean "how"? What difference may it make, Master Page or not?
--SA
[no name] 26-Oct-12 0:45am    
I am not getting you.. Could you please be more specific about your comment?
Sergey Alexandrovich Kryukov 26-Oct-12 1:27am    
I'll try. Master page exists only on server side. On client side the combination of master and context pages makes a regular page delivered in a single HTTP response. I did not see how master or content page can be relevant to GCS. After your comment above, I see the problem of redirection. Nevertheless, "I am not able redirect to another page" is not informative. Perhaps you need to provide minimalistic code sample to focus only on this problem and show what did you try; also describe what happened.

Thank you,
--SA

1 solution

Just Copy paste this code into ASP coding of your Master Page.
and if this didnt work, then ask a question stating your problem.
 
Share this answer
 
Comments
[no name] 26-Oct-12 23:14pm    
you all are not getting my question properly...
I have done this (copy and paste into master page) before I have asked question here..
If I'm putting this code on master page, Its working fine but it displays result on that page from where I'm searching for.. I want result on different page..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900