views:

11

answers:

0

Hi,

I've got some strange problems and I don't know what to do about them. First I have an UpdatePanel which has a GridView inside. In one of the column definition there is a DropDownExtender and a Panel wrapping a CheckBoxList:

     <asp:UpdatePanel ID="updGrid" runat="server">
    <ContentTemplate>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"     DataKeyNames="termNumber">
            <Columns>
             ...
             <asp:TemplateField HeaderText="Värde från fysisk artikel">
                    <ItemTemplate>
                       ...
                       <cc1:DropDownExtender runat="server" ID="CheckBoxListShower" TargetControlID="ListLabelContainer"
                                                DropDownControlID="RealValueListPanel" DropArrowWidth="30px" DropArrowBackColor="Transparent"
                                                DropArrowImageUrl="~/Images/transparent.gif" Enabled="false" />
                                            <asp:Panel runat="server" ID="ListLabelContainer" BorderColor="Gray" BorderStyle="Solid"
                                                BorderWidth="1" Height="16px" Width="235px" BackColor="White" Enabled="false"
                                                Style="padding-left: 2px; padding-top: 2px;">
                                                <asp:Label runat="server" Text="Inga markerade" ID="ListLabel" />
                                            </asp:Panel>
                                            <asp:Panel runat="server" ID="RealValueListPanel" BorderColor="Gray" BorderStyle="Solid"
                                                Enabled="false" Visible="false" BorderWidth="1" BackColor="White" Style="max-height: 500px;
                                                min-width: 240px; overflow-y: auto;">
                                                <asp:CheckBoxList ID="lstRealValue" runat="server" />
                                            </asp:Panel>

It's a bit complicated, but I was not the one originally made the code and there isn't any time to do any redesigning. Anyway, I use jQuery to get which checkboxes are checked to do some server side validation via web services. To get all checked checkboxes I use this statement:

var checkedItems = $("#" + listId + " input[type=checkbox]:checked");

The listId is the client id of a specific CheckboxList in the GridView. This works fine, until I do a partial update on the update panel. After each partial update I get too many result items. Without exactly knowing what happends, it feels like jQuery appends the result from previously the partial update. Ex: First I check "item 1" and then I do a partial update. If I then also check "item 3" the above jQuery statement will result in {"item 1", "item 1", "item 3"}. As it appends the results prior the partial update.

I don't do any jQuery event binding, but I do a trick to prevent the DropDownExtender from closing when checking an item in the checkboxlist.

Any ideas? Any questions?

Regards, Kimmen.