开发者

What would cause FF and Chrome to postback twice (once with a complete reload)?

开发者 https://www.devze.com 2023-04-13 08:27 出处:网络
I am looking for ideas I don\'t know where to start with this one. When I click a button in both FF and Chrome my page does a postback and obeys the if(!ispostback), but immediately after, it does an

I am looking for ideas I don't know where to start with this one.

When I click a button in both FF and Chrome my page does a postback and obeys the if(!ispostback), but immediately after, it does another bu开发者_开发问答t this time it's like a full page reload and it runs the contents of my if(!ispostback)

My webpage has 6 panels that are acting kind of like a wizard, every time you click next one panel is made invisible, and one visible.(The reason it is done this way is because I need to validate al the info in one go, but cannot show it all at once as there is a lot of it!)

The first panel contains a google map that is set up on the window.onload as so: (although this may be completely irrelevant to the problem)

 window.onload = function () {
    initialize();
}
var map;
function initialize() {
    var latlng;
    if ('<%=Latlng %>' != '' ) {
        latlng = new google.maps.LatLng(<%=Latlng %>);
    }       
    else {
        latlng = new google.maps.LatLng(54.290882, -4.833984);
    }
    var myOptions = {
        zoom: 4,
        center: latlng,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    var mapCanvas=document.getElementById("map_canvas");
    if(mapCanvas !=null){ 
    map = new google.maps.Map(mapCanvas, myOptions);

  if ('<%=Latlng %>' != '') {     
    var marker = new google.maps.Marker({
            map: map,
            position: latlng
        });
        map.setZoom(12);}
        else if(document.getElementById('<%=txtPostCode.ClientID %>').value != '')
    {
    SetMap(document.getElementById('<%=txtPostCode.ClientID %>'));
    }  
    }
}

The rest are just textboxes and repeater.

The only thing I have read that may cause the problem is empty "src" attributes on img controls. So I have tried deleting all my img controls and it makes no difference.

I have alot of info in this page so cannot paste it all, but short of going through everything and removing bits one by one to find the offending object, does anyone have any ideas where to start?

It doesn't do it in IE!?

Bex


I'd guess the "empty src attribute" phenomenon is at the root of your problem, though. For some categories of empty attributes, FF will gleefully interpret these as references to the current URL itself and trigger a second GET of your page, in an attempt to use the returned data as some kind of content. This would be the non-PostBack run through the page lifecycle you're seeing there. Network profiling tools should also show that additional request.

You could try going through the rendered HTML (i.e., look at the page source in your browser) and search for "" attributes that might cause that behavior.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号