本文介绍了如何在asp.net中在运行时向gridview的最后一页添加新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我设计了一个gridview,它允许页面大小为5的页面调度,并且我在运行时通过单击代码如下的添加新项"(位于gridview外部)在gridview中添加新行:

Hi,
I designed a gridview it allows paging with page size 5 and i am adding a new row to gridview at run time by clicking a "Add New"(which is outside gridview) that code is as follows:

protected void btnAddNew_Click(object sender, EventArgs e)
       {
           GViewServiceFailnature.ShowFooter = true;
           GetServiceFN();
       }



每当我单击添加新"按钮时,新行就会添加到当前页面(例如:第3页)
但我想添加到最后一页(假设总共有5页,当前我在3页中,然后单击添加新"按钮,应在第5页而不是第3页中添加新行)

请任何人帮助.

谢谢
K uday



whenever i click "Add New" button, new row is adding to the current page(ex:page 3)
but i want to add to last page(suppose there are 5 pages total,currently i am in 3 and clicking "Add New" button a new row should add in page 5 instead of in page 3)

Please help any one.

Thanks
K uday

推荐答案

<FooterTemplate>
   <asp:Button ID="btnAddNew" runat="server" Text="Add New" CommandName="AddNew" CommandArgument="AddNew"

    OnClick="btnAddNew_Click" OnClientClick="return confirm('Add new Record?');" />
</FooterTemplate>




然后在代码中处理click事件,后面应该包含您的逻辑...

希望对您有所帮助.

问候,

Algem




Then handle the click event in your code behind should contains your logic...

Hope this could help.

Regards,

Algem



这篇关于如何在asp.net中在运行时向gridview的最后一页添加新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-02 05:36