Wednesday, March 21, 2012

ModalPopup and empty Listbox

I'm running into an issue where I have an empty listbox within a ModalPopup window. For some reason, the Listbox shows up with an XX appearing in it. The XX is not a ListItem as it is not selectable and can't be edited or removed via code. I even tried to add a ListItem and then clear the Listbox, but clearing the ListBox results in the XX showing up again.

Has anyone else run into this? Is this a known bug? Any workaround?

Thanks in advance,

Matt

I had a similar issue: I tried to put an asp:Button control in a ModalPopup and assign a method to it - it appeared, but didn't perform the desired code. Instead I tried a plain-ole HTML button control and assigned a javascript function similar to what I wanted it to do and it worked.

Later, on ScottGu's blog,he posted the new release of the toolkit and in the post there was mention of the Modal having some updates/fixes performed to it, specifically in regard to positioning, however, I thought I saw somewhere something about the use of server side controls. Hmm... I'll keep looking and update you if I find more.

In the interim, are you able to use a client-side listbox and see if that resolves anything? Or does your LB need to be databound or what? Can you show us some code to see if we can spot anything simple that you may have overlooked (as we all do at times)?

regards,
(bs.)



Thanks for the reply. The listbox does need to be databound in certain circumstances, so the client-side won't work.

Strange, though ... noticing the 'XX' in FireFox 1.5 but not in IE or FF 2.0. Grrrrrrrrrrrrrr ......


Hi,

I tried it on FF 2.0.0.4, this problem still exists. It's hard to tell the exact cause, but you can solve it by adding an item to it when there is no items in the list.

For example:

function pageLoad()
{
var list = $get("ListBox1");

if(list.options.length < 1)
{
list.options.add(new Option(""));
}
}

Hope this helps.

No comments:

Post a Comment