locked
Partial Page update in ListView RRS feed

  • Question

  • User1510859543 posted

    I have a ListView that has Item, Edit and Insert templates.  Sometimes the number of rows is fairly large (100+).  I want to be able to run a special update function when a user checks the checkbox in the detail and only update that one row.  Is there a way (or advantage) to have the UpdatePanel only around the ItemTemplate?  Below is a snippet of my ListView and want to use the ckPartHere checkbox.  Thanks.

            <asp:ListView ID="lvRepairOrderLines" runat="server" DataKeyNames="LineID" 
                DataSourceID="SqlRepairLines" Visible="True">
                <ItemTemplate>
                    <tr runat="server" ID="itemtemplaterow" style="background-color:#FFFFFF; color: #000000; line-height: 20px; ">
                        <td><asp:LinkButton ID="LinesEditButton" runat="server" CommandName="Edit" Text="Edit" />
                            <asp:LinkButton ID="LBtnActivate" runat="server" Text="Activate" CssClass="Hide" 
                                CommandName="activate" CommandArgument='<%# Eval("LineID") %>'>
                            </asp:LinkButton>
                        </td>
                        <td align="center"><asp:Label ID="LblWhoPays" runat="server" Text='<%# Eval("WhoPays") %>' /></td>
                        <td><asp:Label ID="LblDamageDescription" runat="server" Text='<%# Eval("Damage30") %>' ToolTip='<%# Eval("DamageDescription") %>' />
                            <asp:Panel ID="PanelWarranty" runat="server" CssClass="Hide" BorderStyle="Solid" BorderWidth="1pt" BorderColor="Blue">
                                <table>
                                    <tr>
                                        <td style="font-weight: bold">What was found</td>
                                    </tr>
                                    <tr>
                                        <td><asp:Label ID="LblWhatFound" runat="server" Text='<%# Eval("WhatFound") %>'></asp:Label>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="font-weight: bold">What we did about it</td>
                                    </tr>
                                    <tr>
                                        <td><asp:Label ID="LblWhatWasDone" runat="server" Text='<%# Eval("WhatWasDone") %>'></asp:Label>
                                        </td>
                                    </tr>
                                </table>
                            </asp:Panel>        
                        </td>
                        <td><asp:Label ID="LblPartNumber" runat="server" Text='<%# Eval("PartNumber") %>' /></td>
                        <td align="center">
                            <asp:LinkButton ID="LBtnPartEstimatedDeliveryDate" runat="server" 
                                    Text='<%# Eval("PartEstimatedDeliveryDate", "{0:MM/dd}") %>' 
                                    CommandName="Promised" CommandArgument='<%# Bind("PartPurchaseOrder") %>'>
                            </asp:LinkButton>
                            <asp:TextBox ID="txtPartEstimatedDeliveryDate" runat="server" 
                                Text='<%# Eval("PartEstimatedDeliveryDate") %>' CssClass="Hide">
                            </asp:TextBox>
                        </td>
                        <td align="center"><asp:CheckBox ID="ckPartHere" runat="server" Checked='<%# Eval("PartHere") %>' Enabled="false" 
                            AutoPostBack="False" />
                        </td>

    Friday, April 4, 2014 12:00 PM

Answers

  • User-417640953 posted

    Hi dlchase,

    Thanks for your post.

    As all known that the UpdatePanel will generate DIV tag, if we use the UpdatePanel in the table it will upset the layout of table.

    So I think you can set the ListView layout like below.

     <asp:ListView ID="ListView1" runat="server">
                <LayoutTemplate>
                    <table>
                        <tr>
                            <td>
                                <table>
                                    <tr><td>col1</td><td>col2</td><td>col3</td><td>col4</td></tr>
                                </table>
                            </td>
                        </tr>
                        <tr runat="server" id="itemPlaceholder" /> 
                    </table>
                </LayoutTemplate>
                <ItemTemplate>
                        <tr>
                            <td>
                                <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
                                    <ContentTemplate>
                                         <table>
                                           <tr><td>col1</td><td>col2</td><td>col3</td><td>col4</td></tr>
                                         </table>
                                    </ContentTemplate>
                                </asp:UpdatePanel> 
                            </td> 
                        </tr>
                </ItemTemplate>
            </asp:ListView>

    Hope that helps, thanks.

    Best Regards!

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Tuesday, April 8, 2014 2:03 AM