Click here to Skip to main content
15,886,258 members

Listbox loading inconsistently in master page with images

woopsydoozy asked:

Open original thread
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.
Tags: ASP.NET

Plain Text
ASM
ASP
ASP.NET
BASIC
BAT
C#
C++
COBOL
CoffeeScript
CSS
Dart
dbase
F#
FORTRAN
HTML
Java
Javascript
Kotlin
Lua
MIDL
MSIL
ObjectiveC
Pascal
PERL
PHP
PowerShell
Python
Razor
Ruby
Scala
Shell
SLN
SQL
Swift
T4
Terminal
TypeScript
VB
VBScript
XML
YAML

Preview



When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the http://www.codeproject.com/info/cpol10.aspx.



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