开发者

ASP.NET Menu control changing position after postback

开发者 https://www.devze.com 2023-03-12 15:54 出处:网络
I am currently testing a menu in ASP.NET I\'ve recently made using asp:menu control. The menu is just as I want it to be right now, but whenever there is a postback that updates the whole page, it mo

I am currently testing a menu in ASP.NET I've recently made using asp:menu control.

The menu is just as I want it to be right now, but whenever there is a postback that updates the whole page, it moves a little downwards (only once, a second postback won't move it a little bit more).

  • It's not CSS - > I've removed all CSS from this menu)

  • It's not any property -> I've commented out everything related to customizing the menu

  • It's not any other element above it enlarging -> I've specially put it inside a table, in which the only content is the asp:menu control

    It moves a lot downwards in IE6, a little in IE8, and it doesn't mo开发者_开发问答ve at all in Firefox 4.

    What could I do ? Are there any alternatives ? Is there any property I can use, or any outer element I could put it inside in order for it to stay still ?

    And yes, every single machine this is going to run in is using Internet Explorer. The nightmare of any web developer.

    ---[update]-----

    I've built a menu in a separate project, and the effect wasn't there! I've copied the exact same files into my project, and ran it, and the issue was there.

    Could it be a difference in the asp.net version ?


    Did you check using IE web developer toolbar to see what's the html looks like in that area before and after the postback? It seems more like a browser issue so the toolbar would give you details as what is coming in the gap or may be what's pushing it down.


    If the app is in asp.net 4.0, look at the source code of the page after it renders the first time, and then after the postback. Make sure it renders as divs on both or tables on both.

    I currently have a similar issue where my menu "spreads out" on the postback. Before the postback, it renders divs. After the postback, it renders tables.

    There is specifically a property on the menu "RenderingMode" which is suppose to control this, but it is not working for me.


    I had the same problem. My navigation menu sits in an UpdatePanel, and I changed the UpdateMode from Always to Conditional - problem solved. This was in my master page.

  • 0

    精彩评论

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

    关注公众号