Hi,
I am trying to work through a program but getting really stuck.
I have a asp.net (aspx) page which shows a table of data from a SQL query to the DB. This all works fine. I have a <body onload='resizediv()';> which calls a JavaScript code that resizes the DIV that the table data is displayed in - just so it adds a scrolling area if the table data is >400px deep.
This all works just fine and as it should.
So I thought I would Ajax enable it with a panelupdate control which I wrapped around the Table and DIC that displays the data from the DB. Again this all works as it should - clicking on my "refresh" control button the ajax re-loads the table data without the nasty page flicker.
BUT - my onload='resizediv();' JS function is not called when the updatepanel is refreshed ... it is called the first time the page loads but not when I click on the button control that does the refresh of the panel. Is there anyway to make this JS function fire each time the Ajax panel is updated ?
Apologies if this description is hard to understand, but I am very new to asp.net and Ajax ... :(
Thanks in advance ...
Ro
No ideas on how this could be done ? or am I just looking at this from the wrong angle ?
Thanks
Ro
Instead of using onload=..., try:
<script type="text/javascript">
Sys.Application.add_load(function() { ... });
</script>
If memory serves, the Load event should fire on initial page load as well as any async postbacks.
Steve,
Excellent reply, just tried this and indeed it works with load and partial page loads.
This will help me out no-end ....
Many thanks,
Ro
No comments:
Post a Comment