views:

114

answers:

4

Hi,

i'm using a javascript function to reset some fields in my .aspx webpage.It does work when the page is loaded the first time but after a postback it doesn't work at all.

Can someone please give me an explanation ?

Thanx

A: 

Most likely those field values are set from viewState or the server is overriding the values. A code example would help provide a more concrete explaination. I've managed to find this article that might help you.

RichardOD
+1  A: 

I see you've tagged this as asp.net-ajax, if it is only a partial postback you're doing, then the entire page isn't being reloaded and the javascript functions wont fire.

If this is the case, try using ClientScript.RegisterStartupScript to specify which javascript function to call.

Otherwise, code samples would help us answer!

Kirschstein
A: 

Try

function pageLoad () {
//do something
}
Hans Malherbe
A: 

Checkout jQuery if you have not used it.

$(document).ready(function() {

    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_pageLoaded(updateWidgets);
});

function updateWidgets() {
    //do your stuff here
}
chris