0

Possible Duplicate:
how can I call javascript function from another project in same solution?

I am using an asp.net 3.5 web solution with js which contains 2 projects ProjectA and ProjectB. Is it possible to call a js function which is defined in ProjectA in a scriptfile from somewhere in ProjectB? what would the script reference be?

1
  • 2
    Almost the same wording as another user's question last week: stackoverflow.com/q/7974131/615754 - is this homework or something? Commented Nov 10, 2011 at 11:15

1 Answer 1

0

You will first have to load the script from the project A while the Project B loads. You can try the code below

// Get a ClientScriptManager reference from the Page class.
ClientScriptManager cscript = Page.ClientScript;

// Register the client resource in the page.
cscript.RegisterClientScriptResource(rstype, 
     "CompanyName.ProjectA.Scripts.YourScript.js");

Now if you call the method in the YourScript.js file from the project B , i should work. Note: Please make sure that you load the 'YourScript.js' file before you call the method in that file.

Sign up to request clarification or add additional context in comments.

1 Comment

it does not work:( did you try to run the code?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.