This is a migrated thread and some comments may be shown as answers.

Google Search Webpart

2 Answers 69 Views
Button
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 2
Phil asked on 05 Jan 2012, 06:33 PM
Hi:
No question.  Just sharing a code snippet.  This code is from a web-part that searches Google in a new window (client-side):
<div id="GoogleSearch">
    <telerik:RadTextBox ID="searchTextBox" Runat="server"
        EmptyMessage="Type your search criteria here..." Width="260px">
    </telerik:RadTextBox>
    &nbsp; &nbsp;
    <telerik:RadButton ID="searchButton" runat="server" Target="_blank" CausesValidation="False" Text="Search" ButtonType="LinkButton" OnClientClicking="LaunchGoogleWindow" />
</div>
<script type="text/javascript">
    //<![CDATA[
    function LaunchGoogleWindow( ) {
        var str, txt = $find("<%= searchTextBox.ClientID %>");
        var lkButton = $find("<%= searchButton.ClientID %>");
        str = encodeURIComponent(txt.get_value());
        // alert(txt.get_value());
        lkButton.set_navigateUrl("http://www.google.com/search?hl=en&q=" + str);
    }
    //]]>
</script>
Phil

2 Answers, 1 is accepted

Sort by
0
Abhishek
Top achievements
Rank 2
answered on 13 Jan 2012, 08:17 AM
Hi Phil,
The logic to search any content from our site on just a button click is good . Do you know how to include content(only some part of information) of other sites into my existing local site.
E.g:  News, Cricket Scores etc.


Thanks In advance
Abhishek K
0
Phil
Top achievements
Rank 2
answered on 14 Jan 2012, 07:52 PM
Hi:

I am not sure I understand your question.  But with Google one can add:
   site: Telerik.com <search values>
and the above will search Telerik site for the search value.
Phil
Tags
Button
Asked by
Phil
Top achievements
Rank 2
Answers by
Abhishek
Top achievements
Rank 2
Phil
Top achievements
Rank 2
Share this question
or