更新面板使用Listview发回

时间:2015-01-17 22:41:48

标签: c# asp.net ajaxcontroltoolkit

我在一个手风琴控件里面有一个更新面板,两件事应该导致异步回发:

1)当我点击图像按钮

2)我点击了分页。

这两件事都很好,但总是会导致完整的回发。

<asp:UpdatePanel ID="updListView" runat="server" ChildrenAsTriggers="True">
            <ContentTemplate>
                <asp:ListView ID="dlNewLeads" runat="server" DataSourceID="sdsLeads" OnItemCommand="dlNewLeads_OnItemCommand">
                    <ItemTemplate>
                        <table style="width: 642px;">
                            <tr>
                                <td style="width: 421px;">
                                    <asp:Label ID="lblTitle" runat="server" Text="Name" class="repeater-title"></asp:Label><br/>
                                </td>
                                <td style="width: 421px;">
                                    <asp:Label ID="Label3" runat="server" Text="Phone" class="repeater-title"></asp:Label><br/>
                                </td>
                                <td style="width: 421px;">
                                    <asp:Label ID="Label1" runat="server" Text="Time of Lead" class="repeater-title"></asp:Label><br/>
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 421px;">
                                    <asp:linkbutton ClientIDMode="AutoID" ID="btnRem" CommandName="SetAsContacted" runat="server" causesvalidation="false" commandargument='<%# Eval("Id") %>'>
                                        <asp:image id="Image2" runat="server" imageurl="~/Images/x.jpg"/>
                                    </asp:linkbutton> <asp:HyperLink Text='<%# Eval("FullName") %>' NavigateUrl='<%# GetLink(Eval("ID").ToString()) %>' runat="server"></asp:HyperLink>
                                </td>
                                <td style="width: 421px;">
                                    <asp:Label ID="Label4" runat="server" Text='<%# Eval("Phone") %>' class="repeater-text"></asp:Label>
                                </td>
                                <td style="width: 421px;"><asp:Label ID="Label2" runat="server" Text='<%# Eval("TimeOfLead") %>' class="repeater-text"></asp:Label>
                                <td style="max-width: 76px; min-width: 76px;">

                                </td><br/>
                                </td>
                            </tr>
                        </table>

                        <div style="background-color: #dae5e7; height: 1px; width: 590px;"></div>

                        <br/>
                    </ItemTemplate>
                </asp:ListView>
                <asp:DataPager ID="DataPager1" runat="server" PagedControlID="dlNewLeads" PageSize="5">
                    <Fields>
                        <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" ShowLastPageButton="True"/>

                    </Fields>
                </asp:DataPager>
            </ContentTemplate>

        </asp:UpdatePanel>

我将ListView与SqlDataSource绑定

<asp:SqlDataSource ID="sdsLeads" runat="server" ConnectionString="<%$ ConnectionStrings:SjkConnectionString %>" SelectCommand="SELECT [Id], [FullName], [TimeOfLead], [Phone] FROM [RequestContacts] WHERE (([IsAnswered] = @IsAnswered) AND ([Id] = @Id))">
    <SelectParameters>
        <asp:Parameter DefaultValue="False" Name="IsAnswered" Type="Boolean" />
        <asp:Parameter DefaultValue="0" Name="Id" Type="Int32" />
    </SelectParameters>
</asp:SqlDataSource>

然后在表单页面加载

If(!IsPostBack)
sdsLeads.SelectParameters["Id"].DefaultValue = locationId.ToString();

1 个答案:

答案 0 :(得分:0)

快来找出我的web.config文件中的内容。我不知道究竟是哪一行,所以我无法向任何人提供解决方案。

我替换了我昨晚用备份更改的web.config文件,它立即就可以了。