MSDN Article

Hi,

I just read this article, but I cannot get it to work

is keeps saying that sc is null or not an object.

Anybody got it running

tnx

koen



Answer this question

MSDN Article

  • Yustme

    sorry,

    asp.net is a pet hate of mine, but from what i can see the anti-cross scripting library contains a class for searchClient. It doesn't seem to find it. So i'd imagine that you path does not see it. you copied the searchclient.js into your scripts folder which is visible by the excuting js

    sorry i couldn't help


  • FrankSp

    It wasn't there, but adding it and setting it to false did the trick.

    tnx

    koen


  • Jetpilot86

    Yes,

    i put it in the root folder and even copied the source of the .js file into the header of the html page.

    doesn't seem to work :(


  • vdv_phuong

    Hi,

    tnx for the tip. apparently there are indeed some strange linebreaks.

    However, I now get this error :

    The MaintainScrollPositionOnPostback page directive cannot be set without an htmlform.

    this is my code

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Demo.aspx.cs" Inherits="Demo" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >

    <head runat="server">

    <title>Untitled Page</title>

    <script src="searchClient.js" type="text/javascript"></script>

    <script>

    var sc = new searchClient('keyAndCount', 'returnArea', '(site:msdn.microsoft.com OR site:dev.live.com OR site:microsoftgadgets.com OR site:forums.microsoft.com)');

    </script>

    </head>

    <body>

    <form id="form1" runat=server>

    <table>

    <tr>

    <td>

    <input

    type="text"

    id="keyword"

    title="Enter search keywords"

    size="30"

    value="" />

    </td>

    <td>

    <input

    type="button" onclick="sc.search(document.getElementById('keyword').value);"

    value="Search" />

    </td>

    </tr>

    </table>

    <div class="CommonContentArea">

    <div class="CommonContent">

    <div id="keyAndCount">

    Enter search keywords

    </div>

    <hr />

    <div id="returnArea"

    style="overflow:auto;height:auto">

    </div>

    </div>

    </div>

    </form>

    </body>

    </html>


  • ABS123

    which MSDN article was it
  • A.F.B

    Have you set the MaintainScrollPositionOnPostback directive in searchProxy.aspx If yes take it out.


  • wistaria

    Oops ,

    here it is :

    Building Search for Your Web Site with the MSN Search Service

    http://msdn.microsoft.com/library/default.asp url=/library/en-us/dnlive/html/BuildSearch.asp

    koen


  • inzel

    Hi Guys,
    Just got the:
    The MaintainScrollPositionOnPostback page directive cannot be set without an htmlform

    Had to remove this feature and restart the worker process to resolve.
    However, I noticed why I was getting the error.

    The page source did not contain a webresource.axd reference when it errored.

    The second time I loaded the page, webresource.axd was present and everything worked as expected.

    My question is:  Why isn't webresource.axd appearing in my page source the 
    first time I view the page

    Thanks,
    Dave.



  • TimGL

    I got it to work within 15 minutes.

    Your problem is the JavaScript source code. If you copy it from the page to Visual Studio you get some line breaks and other sources of errors. Debug the code with the JavaScript console of the Firefox browser.

    If you have further questions please ask me.


  • MSDN Article