Listbox Flicker

M

Mark Roberts

Hello Everyone,

A co-worker and I came across something strange when a listbox is placed on
a page with a menu (these are the standard 2.0 controls, of course). The
menu is set to horizontal orientation and contains a few submenu items. It
seems that if the height is set on the listbox (as a percentage or pixels or
em), the listbox will flicker when you hover over the submenu items. This
may be specific to IE as the flickering does not happen for us under
Mozilla.

After quickly scouring these newsgroups and a bit of googling, the only
other reference to this problem was found here:
http://www.softconcepts.com/blogs/pkimmel/2005/11/aspnet-listbox-flicker.html

We tried the advice given there, but the flickering persisted. Playing
around a little more, we found that by controlling the listbox height via
the "Rows" property and not explicitly setting a height, the flickering does
not occur. This seems to be a reasonable work around for us; however, I am
curious what the cause of this flickering may be.

Here's some code that causes the flickering for us:

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Menu ID="mnu" runat="server" Orientation="Horizontal">
<Items>
<asp:MenuItem Text="file">
<asp:MenuItem Text="new" />
<asp:MenuItem Text="open" />
<asp:MenuItem Text="exit" />
</asp:MenuItem>
<asp:MenuItem Text="edit">
<asp:MenuItem Text="cut" />
<asp:MenuItem Text="copy" />
<asp:MenuItem Text="paste" />
</asp:MenuItem>
<asp:MenuItem Text="view" />
<asp:MenuItem Text="help" />
</Items>
</asp:Menu>
<br />
<asp:ListBox ID="lb" Height="10em" runat="server"
style="width:100px">
<asp:ListItem Text="one" />
<asp:ListItem Text="two" />
<asp:ListItem Text="three" />
<asp:ListItem Text="four" />
</asp:ListBox>
</div>
</form>
</body>
</html>

If we replace the height property on the listbox with, say, "Rows="10"", the
flickering stops. Has anyone else encountered this behavior, or does anyone
have an idea of why it happens?

Thanks!


Mark
 
J

johnsonparakkad

Hi Friend,
Please set the ListBox Rows property value as '1' instead of width. And you should change the ListSelectionMode as Multiple.

Eg:
lstGroup.Rows=1;
lstGroup.SelectionMode=ListSelectionMode.Multiple;

Thanks & Regards
Johnson Mathew
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top