tags:

views:

15

answers:

1

Hi

I have some java script code, which needs to run against my gridview when it loads up to the page. The gridview itself is dynamically added to the page through a user control.

To apply the script, I have written the following code, which is applied using page pre render method: gridview1.attributes.add["onload"] = "configureGridview()";

The JavaScript function itself is on the master page. I do have other javascript functions on my master, and these all work but this one!

Please help!!!!

A: 

You can use jQuery

$(document).ready(function() {
configureGridview()
});

or simple pure HTML and Js

<body onload='configureGridview()'>

I highly recommend the jQuery solution since it has many benefits, like waiting for the DOM to load before running.

Omar Abid