__doPostBack is refreshing my whole page, not just UpdatePanel

OK, so I’m using __doPostBack() to reload data in an update panel based on some javascript after the user enters data.

Everything on the page is working correctly, except that when the javascript tells it to fire and reload the updatePanel, the whole page reloads and the UpdatePanel1_Load() isn’t firing.

Any idea why? Here’s my javascript to fire it:

var submitTimerID

function jsfunct_textChange(obj_validateItem, validationStyle, validationFailDefaultValue, objPanelToUpdate){
            var isValid = true;

            if (validationStyle == 'numeric'){
                if (
                    (obj_validateItem.value != parseInt(obj_validateItem.value) ) &&
                    (obj_validateItem.value.length > 0)
                        alert('Value must be a number!');
                        isValid = false;
                        obj_validateItem.value = validationFailDefaultValue;
            } // numeric validation

            if (isValid){
                if (typeof submitTimerID != 'undefined') {clearTimeout ( submitTimerID );}
                submitTimerID = setTimeout ( "jsfunct_SendUpdate('" + objPanelToUpdate + "');", 3000 );
        }// jsfunct_textChange

        function jsfunct_SendUpdate(objPanelToUpdate){
            var obj_Panel = document.getElementById(objPanelToUpdate);
            __doPostBack(obj_Panel, '');

Here’s the update panel:

    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">

And in my codebehind:

        protected void UpdatePanel1_Load(object sender, EventArgs e)

        protected void Page_Load(object sender, EventArgs e)

The LoadGrid(); method will fire when in Page_Load(), but not when it’s in UpdatePanel1_Load(), which makes sence, as the whole page is loading, but the panel isn’t refreshing.

Any help is much appreciated!

One of the most common things that new ASP dotnet AJAX developers overlook is that all of the Page’s life cycle events do execute during every partial postback. During a partial postback, the Page’s control tree is fully reinstantiated and every single control runs through its life cycle events. If that’s not taken into account, it’s very easy to run into mysterious difficulties.

Search the above text in good and you will find an article explaining it. The forum is yelling at me for posting links.


try this:
encosia dotcom

Yelling at you? That’s weird…


Ah, might be your post count

Thats what it was… it was saying I had <10 posts. I was trying to hack the URL in to 50 pieces and it was still denying my post but come to find out I had “ASP .NET” in the post and that was causing it to kick back. I was ~5 minutes figuring out how to submit :slight_smile: