【发布时间】:2012-02-14 04:24:40
【问题描述】:
编辑:2012 年 2 月 7 日 - 结果在排序后关键参数也从 GridView 编辑链接中消失了,所以它毕竟不是寻呼机,但问题仍然存在......任何想法都非常欢迎。
我有一个 Asp.Net 动态数据应用程序。它使用自定义 List.aspx 中的标准 GridViewPager.aspx,其标记如下:
<asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource" EnablePersistedSelection="True" CssClass="DDGridView" HeaderStyle-CssClass="th" RowStyle-CssClass="td" CellPadding="6" AllowSorting="True" AllowPaging="True" PageSize="3"
OnRowDataBound="GridView_OnRowDataBound" OnRowDeleting="GridView_OnRowDeleting">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LoginView ID="LoginView1" runat="server">
<RoleGroups>
<asp:RoleGroup Roles="admin">
<ContentTemplate>
<asp:DynamicHyperLink ID="EditLink" runat="server" Action="Edit" Text="edit" />
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Delete" Text="delete" OnClientClick='return confirm("Are you sure you want to delete this item?");' />
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
</asp:LoginView>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<PagerStyle CssClass="DDFooter" />
<PagerTemplate>
<asp:GridViewPager runat="server" />
</PagerTemplate>
<EmptyDataTemplate>
There are currently no items in this table.
</EmptyDataTemplate>
</asp:GridView>
在列表的第 1 页上一切正常。呈现的编辑链接包括?key=xxxxx,并且编辑表单打开到正确的记录。
然而,一旦我们离开第 1 页,每行呈现的编辑链接就没有“键”参数,并且编辑表单总是打开到数据库中的第一行。
我无法解释这一点,甚至无法解释。与 Edit DynamicHyperlink 或 GridviewPager 关联的任何事件都没有附加自定义代码。
有没有人遇到过这种情况或对可能出现的问题有任何建议?
【问题讨论】:
标签: asp.net .net gridview dynamic-data