Click here to Skip to main content
16,016,157 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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:

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


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
Posted
Updated 30-Aug-11 21:29pm
v2
Comments
BobJanova 31-Aug-11 11:33am    
You need to show where you're actually adding the row. That is where a change may need to be made.

Hi

Try to Modify your btnAddNew to be inside your grid column.

Example client code:

XML
<FooterTemplate>
   <asp:Button ID="btnAddNew" runat="server" Text="Add New" CommandName="AddNew" CommandArgument="AddNew"
    OnClick="btnAddNew_Click" OnClientClick="return confirm('Add new Record?');" />
</FooterTemplate>



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

Hope this could help.

Regards,

Algem
 
Share this answer
 
Refer this link and give your page no.
http://forums.asp.net/p/1222691/2185804.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900