Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript
Hello Sir,
 
I want to Multiple Aspx Page Validate in Single JavaScript Code.
 
I write a JavaScript for a Single Page But this JavaScript code Use for All Pages.
 
How Can Possible and how to Add one JavaScript to All Pages.
 

Thanks
Ashish Jaiswal
Posted 16-Feb-13 21:00pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

How Can Possible and how to Add one JavaScript to All Pages.
1. Make sure your JavaScript methods are generic enough to handle any page call.
2. Put all the JavaScript into a *.js file instead in webpage
3. Refer the above JavaScript file in all the web pages needed. You would need to add the script tag in webpage <HEAD> tag:
<script type="text/javascript" src="Scripts/Utilities.js"></script>
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Just call that java script page on your aspx page.
<link href="path of javascript page" />
and in javascript page create common function with control & message for every type validation then use that Just try it.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

You need to add javascript reference to your master page. Actually all pages use Masterpage. If any page not use master page then you individually add that script file reference to that page. Then from all pages, you can call that javascript method.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 /\jmot 230
1 Richard MacCutchan 185
2 Zoltán Zörgő 160
3 Richard Deeming 145
4 Sergey Alexandrovich Kryukov 145
0 Sergey Alexandrovich Kryukov 9,353
1 OriginalGriff 6,881
2 Peter Leow 4,537
3 Zoltán Zörgő 4,009
4 Richard MacCutchan 2,882


Advertise | Privacy | Mobile
Web04 | 2.8.150129.1 | Last Updated 17 Feb 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100