Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
how to call a javascript function of external file on onload or onsorted events of gridview in asp.net
Posted 6-Nov-11 17:44pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

  Permalink  
Comments
thatraja at 7-Nov-11 11:50am
   
5!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

You may follow below steps for this.
 
1) Add a reference of your External JavaScript file in your Aspx Page.
<script type="text/javascript" src="Scripts/MyJavascript.js"></script>
2) Use Load or/and Sorting Evetnts of your GridView to call your JavaScript function.
 
http://msdn.microsoft.com/en-us/library/system.web.ui.control.load.aspx
 
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.sorting.aspx
 
3) Call JavaScript function as below.
this.ClientScript.RegisterClientScriptBlock(this.GetType(), "GridLoad", "<script type="text/javascript">Test()</script>");
  Permalink  
Comments
thatraja at 7-Nov-11 11:50am
   
5!
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

All you need is some customization(by your own), here some examples for you.
 
Using JavaScript with ASP.Net GridView Control[^]
GridView Examples in ASP.NET 2.0 3.5[^]
GridView Examples[^]
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 385
1 George Jonsson 339
2 CPallini 335
3 BillWoodruff 314
4 OriginalGriff 227
0 OriginalGriff 5,030
1 CPallini 4,225
2 Sergey Alexandrovich Kryukov 3,604
3 George Jonsson 2,831
4 Gihan Liyanage 2,386


Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 7 Nov 2011
Copyright © CodeProject, 1999-2014
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