I'm currently working on a project where I need to use a lot of AJAX AutoCompleteExtenders, and they have been working fine- but now I'm tidying up the code and implementing a master page, I'm running into issues. I have this JS:
$find('txtName')._onMethodComplete = function(result, context) {
$find('txtName')._update(context, result, false);
webservice_callback(result,context);
};
And when I load the page, this error occurs relating to that snippet:
Microsoft JScript runtime error: 'null' is null or not an object
Just to reiterate, this only happens when I have a master page for some bizarre reason. Any ideas?
You need to use <%=txtName.ClientID%>
because with master pages in use your ids will be mangled to avoid namecollision between masterpage and aspx/usercontrols etc.
However please note that to be able to use <%=
you will have to include the JS in the ASP.NET markup code. This can be done with the IIS #include
rather than using script
's src.
Example:
<!-- #Include virtual=".\JS\YourJSFileWithASPNETMarkup.js" -->