1

Can we use javascript in sharepoint 2010 web part using visual studio 2010?

2 Answers 2

1

Yes, See Creating a Web Part with Client-side Script

http://msdn.microsoft.com/en-us/library/dd584169(v=office.11).aspx

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

2 Comments

thanks madhur for the link. i have gone through it. i have another doubt that 1. if we are using linked script file then what should be the location of that file? 2. if i want to validate text box then how to pass text box value in javascript function?
You can put the script in layouts or embed it itself in dll
0

You can utilize JavaScript in your web parts just as you would HTML or CSS. As for it's location, a common place to store these files is in the Style Library. You would then create a reference to the JavaScript file in your masterpage or page layout (depending on your needs) where it would be available at runtime.

I would recommend using SharePoint Designer for managing and versioning these style-related files.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.