Google Search Webpart

3 posts, 0 answers
  1. Phil
    Phil avatar
    273 posts
    Member since:
    Jul 2008

    Posted 05 Jan 2012 Link to this post

    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. Abhishek
    Abhishek avatar
    45 posts
    Member since:
    Jul 2012

    Posted 13 Jan 2012 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Phil
    Phil avatar
    273 posts
    Member since:
    Jul 2008

    Posted 14 Jan 2012 Link to this post

    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
Back to Top