[Last Call] Learn how to a build a cloud-first strategyRegister Now


How to find javascript function in the sharepoint advanced search webpart

Posted on 2009-12-21
Medium Priority
Last Modified: 2012-05-08
: I want to include my javascript function in one of the advanced search webpart's java script functions but I cannot find them. When I do page view source I see lot of Javascript rendered in the page. Where that javascript functions are coming for example one of the function by name
ReSetPageHashcode() javascript function but I cannot find in advance.aspx or advancepagelayout.aspx.
Any ideas please...

Note: The webpart is out of box sharepoint webpart.
Question by:vmandem

Expert Comment

ID: 26102884
Install "JSView" addon in Firefox
then open you URL in firefox,

This add-on will show all javascripts separately. and you can find your function easily


Author Comment

ID: 26105015
It is not the question of finding the javascript function seperatly on a page but where those javascript functions are coming from and rendered on that page.
LVL 26

Accepted Solution

rdcpro earned 500 total points
ID: 26105886
A lot of that javascript is emitted by ASP.NET and SharePoint controls.  You can register your own javascript code on a page.  
See the attached snippet for an example of how to emit javascript.  Depending on where you put this in your code, you can have the script registered on the first load of the page or on postback.  
Mike Sharp

// create a string to hold the javascript
string embedClientScript = "<script>alert('it worked!');</script>";
string clientScriptKey = "UniqueName";

// This works, but is obsolete

// First check to see if the javascript block has already been registered.
if (!Page.IsClientScriptBlockRegistered(clientScriptKey))
	Page.RegisterClientScriptBlock(OpenScriptKey, embedClientScript);

// This is the current implementation

ClientScriptManager script = Page.ClientScript;

if (!script.IsClientScriptBlockRegistered(this.GetType(), clientScriptKey))

	script.RegisterClientScriptBlock(this.GetType(), clientScriptKey, embedClientScript);


Open in new window


Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Note:  There are two main ways to deploy InfoPath forms:  Server-side and directly through the SharePoint site.  Deploying a server-side InfoPath form means the form is approved by the Administrator, thus allowing greater functionality in the form. …
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question