Welcome Guest Search | Active Topics | Sign In | Register

Problem with ListBox.ClientSideOnItemSelected Options
Joan Darling
Posted: Tuesday, September 4, 2012 10:27:41 AM
Rank: Advanced Member
Groups: Member

Joined: 3/9/2010
Posts: 119
The js function assigned to the event is being fired twice when ever a new item is selected. The first time it is called the appropriate item is selected. The second time it is executed a different item is returned by the getSelectedItem().
eo_support
Posted: Tuesday, September 4, 2012 12:55:30 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

We tested this feature and it works fine here. So if the problem continues, please try to isolate the problem into a test page and posts the test page. Once we have that we will look into it again.

Thanks!
Joan Darling
Posted: Wednesday, September 5, 2012 11:34:10 AM
Rank: Advanced Member
Groups: Member

Joined: 3/9/2010
Posts: 119
The following is the code for the combo\listbox. Image 1 is the call stack when the function is called after the user has selected an item and the combo box has been updated. Image 2 is when the call to the function adni in image 1 is completed. It looks like the call to eo_SetComboBoxValue (Image 2) is what is firing the second call to the function. In the second call the selected item is different.





Code: HTML/ASPX
<eo:ComboBox runat="server" Width="400px" ID="cboTask" ControlSkinID="None" 
    HintText="Select task..." EnableViewState="False" AllowCustomText="False" 
    EnableKeyboardNavigation="False">
    <IconAreaStyle CssText="font-family: Verdana; font-size: 11px; background-image:url(00107007); background-position: left left; background-repeat:no-repeat; vertical-align:middle;padding-left:2px; padding-right:2px;" />
    <DropDownTemplate>
        <eo:ListBox ID="lsbTasks" runat="server" ControlSkinID="None" Height="150px" Width="600px" DataTextField="Task" MultiSelectModifier="None" EnableKeyboardNavigation="True" ClientSideOnItemSelected="taskChanged">
            <DisabledItemStyle CssText="background-color: white; color: #c0c0c0; padding:2px;" />
            <ItemStyle CssText="background-color: white;padding:2px;" />
            <ListBoxStyle CssText="background-color:white; border-bottom-color:#999999; border-bottom-style:solid;border-bottom-width:1px;border-left-color:#999999;border-left-style:solid;border-left-width:1px;border-right-color:#999999;border-right-style:solid;border-right-width:1px;border-top-color:#999999;border-top-style:solid;border-top-width:1px;color:black;cursor:hand;font-family:Verdana;font-size:9pt;" />
            <HeaderStyle CssText="background-image:url('00020013'); background-position: left top; background-repeat: repeat; height:16px;padding-bottom:2px;padding-left:2px;padding-right:2px;padding-top:2px;" />
            <HeaderTemplate>
                <table>
                    <th>
                        <td style="font-family: Verdana; font-size: 9px; font-weight: bold; color: floralwhite; background-color: darkolivegreen; border-style: solid; border-width: 1px; width: 500px; text-align: center">Task</td>
                        <td style="font-family: Verdana; font-size: 9px; font-weight: bold; color: floralwhite; background-color: darkolivegreen; border-style: solid; border-width: 1px; width: 100px; text-align: center">Remaining Hours</td>
                    </th>
                </table>
            </HeaderTemplate>
            <SelectedItemStyle CssText="background-color: #08246b; color:white; padding:2px;" />
            <ItemHoverStyle CssText="background-color: #f1f1f1;padding:2px;" />
            <ItemTemplate>
                <table border="0" cellpadding="0" cellspacing="0">
                    <tr>
                        <td style="font-family: Verdana; font-size: 9px; width: 500px; text-align: left;">
                            <%#Eval("Task")%>        
                        </td>
                        <td style="font-family: Verdana; font-size: 9px; width: 100px; text-align: right;">
                            <%#Eval("Hr")%>      
                        </td>
                    </tr>
               </table>
            </ItemTemplate>
        </eo:ListBox>
    </DropDownTemplate>
    <TextStyle CssText="font-family: tahoma; font-size: 11px;" />
    <TextAreaStyle CssText="font-family: tahoma; font-size: 11px; border-top: solid 1px #3d7bad; border-bottom: solid 1px #b7d9ed; vertical-align:middle;padding-left:2px; padding-right:2px;" />
    <ButtonStyle CssText="width:17px;height:23px;" />
    <ButtonAreaStyle CssText="background-image:url(00107005);" />
    <IconStyle CssText="width:0px; height:0px;" />
    <ButtonAreaHoverStyle CssText="background-image:url(00107006);" />
    <HintTextStyle CssText="font-style:italic;background-color:#c0c0c0;color:white;line-height:15px;" />
</eo:ComboBox>
eo_support
Posted: Wednesday, September 5, 2012 10:08:01 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,195
Hi,

This can happens if you have two items with the same text. For example, if you have a ComboBox with the following items:

ABC
abc

Then when user selects the second item, it would first trigger your handler with item "abc", then automatically selects the first item (since the lower form of "ABC" matches "abc") and trigger your handler with the first item. If all items have different texts, then your handler will still be called for a second time, however it will be with the correct item.

We are looking into it and see how to avoid the second call all together --- in the mean time if you can somehow differentiate the item text, that should avoid the "wrong item" issue for you.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.