Showing posts with label program. Show all posts
Showing posts with label program. Show all posts

Wednesday, March 28, 2012

Ajax UpdatePanel and onload=JavaScript Function

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

Monday, March 26, 2012

Ajax Toolkit issue with web deploy project in Visual Studio 2005

Error 157 Unable to copy file "C:\Program Files\Microsoft ASP.NET\ASP.NET 2.0 AJAX Extensions\AJAX Control ToolKit\SampleWebSite\Bin\zh-CHT\AjaxControlToolkit.resources.dll" to "C:\Documents and Settings\UserName\My Documents\Visual Studio 2005\Projects\TipWebCurrent\TipWeb\Bin\zh-CHT\AjaxControlToolkit.resources.dll". Access to the path 'C:\Documents and Settings\UserName\My Documents\Visual Studio 2005\Projects\TipWebCurrent\TipWeb\Bin\zh-CHT\AjaxControlToolkit.resources.dll' is denied. 1 1 TipWeb_deployProject

I am getting the above problem when I try and build my solution,(web deploy project specifically) is it as simple as changing the properties of the read-only access for each folder to false for each of the folders containing the dll's?


Yes, the directory that you are publishing to or at least the bin should have right access until you are done deploying, then make it read only again.


Yep, that was the main issue... Once I changed the permissions it worked like a charm!

:)