Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
5.00/5 (3 votes)
See more:
EDIT: OK, I think I have my solution, but maybe someone else can explain why. I am not doing any AJAX on the content or master page, but if I add AJAX's ToolkitScriptManager to my page, it seems to work fine. An AJAX requirement where there is no AJAX? Is there AJAX hidden in the master/content interaction?

ORIGINAL QUESTION STARTS HERE:

I've got a master page, and a content page with 2 listboxes that works fine. Another content page has 2 listboxes as well, but sometimes (2-3 times out of 10) the listboxes show as collapsed, either on postback or on initial load. The notable difference between the two pages is that the one that works is taking a lot longer to fetch and load its data into the listboxes.

I've broken this out to a simpler test app, and I find that I can repeat the same result when I include the master page's image logos. If I exclude the images, the listboxes load correctly every time; same back in the original app. I tried copying the images to my app's subfolders, but no change. Any ideas what's happening?

EDIT: some additional information. The presence of a script tag in the content page is also important, even if nothing is calling the script. Try it for yourself (hopefully this isn't limited to my machine) ...

1. Start a new ASP.NET web application.
2. Add a couple images above the navigation menu:
HTML
<div class="logos">
    <img alt="icon 1" src="images/image1.png" height="50" />
    <img alt="icon 2" src="images/image2.png" height="50" />
</div>

3. In the default page, add this to the body content:
ASP.NET
<div>
    <div>
        <span>
            listbox 1
            <asp:ListBox ID="lstMyTask" runat="server" Height="30%" Width="100%">
            </asp:ListBox>
        </span>
   </div>
</div>
<div style="width:100%;margin-removed5px;">
    <asp:Button ID="btnPostback" runat="server" Text="Postback"/>
</div>
<script type="text/javascript">
    function someFunction() {
        alert('something running this?');
    }
</script>

4. In the code behind for the default page, add this (this is VB):
VB
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    If Not IsPostBack Then
        For i As Integer = 0 To 9
            lstMyTask.Items.Add(New ListItem(i + 1 & ": item " & i))
        Next
    End If
End Sub

5. Configure and run your web app
6. Click the Home tab and/or the Postback button 20 times or so, and you should see it glitch at least once.
Posted
Updated 24-Apr-12 4:08am
v3
Comments
Sandeep Mewara 23-Apr-12 13:09pm    
Interesting. Strange behavior. I will follow the question and see how the discussion goes. My 5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900