Delete last row in the last page in dg cause Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount.

Hi to all,

I am not sure how many of you encountered such error. I have created a datagrid with a delete option. When I have a couple of pages lets say 3 pages in each page it has 3 records. So the problem arise when I am at page 3 (final page) and attempting to delete the last record on the last page. I get such error. you can view the error description and the code in the following link. I have posted this quesiton in many newsgroup and got no answer. I hope this datagrid newsgroup will help me solve such issue. thanks again
Al
http://aalhussein.webhostme.com/Q/dg_delete_last_row2.html
New to Asp.net
0
aalhussein
3/2/2004 6:10:48 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

1 Replies
587 Views

Similar Articles

[PageSpeed] 17

This would happen if you don't have enough records in the datasource for a third page after the delete.
Jim


MS MVP ASP.NET [VC++/MFC emeritus]


Old Dog Learns New Tricks

Preferred programming language: cuneiform on clay tablets
0
JimRoss
3/2/2004 6:48:46 PM
Reply:

Similar Artilces:

Datagrid delete causes Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount
Here's my scenario: 1. Go to last page in datagrid 2. Click button to select the checkboxes next to all the rows in the data grid 3. Click button to delete all checked items 4. Error on page of: Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount 5. This doesn't happen if I click the "Delete" button for a row which would be the last record on the last page Below is where the error happens, on DataGrid1.DataBind() Sub BuildDataGrid() Dim strSQLDG As String strSQLDG = "SELECT ......" 'Create the command item Dim sCon1 As New SqlConnection sCon1.ConnectionString = Session(...

Datagrid paging: Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount.
Hi guys, I am encountering a problem doing paging on my datagrid. I have no problems when the datagrid appears and is on page 1. However, when I click on pages 2 and more, i get the following error: Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount. This is my code: Private Sub searchLocation() 'Connection strings to populate datagrid... Dim myDataAdapter As New OleDbDataAdapter(dbCmd) myDataAdapter.SelectCommand = dbCmd Dim myDataSet As New DataSet myDataAdapter.Fill(myDataSet, "dgSearch1"...

Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount.
HI, I am note sure why I am getting such error, but whenI got to the last row in a datagrid, and delete it,I get the following errror.Please advice for any help. thanks Al Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Web.HttpException: Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount. Source Error:...

Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount
I DONT GET IT my first page is ok and pageindexing is via the automatic method (property builder) my CurrentPageIndex value = 0 my DataGrid1.PageCount=9 my sub is as follows, BUT I GET THIS ERROR?? Private Sub DataGrid1_PageIndexChanged(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridPageChangedEventArgs) Handles DataGrid1.PageIndexChanged DataGrid1.CurrentPageIndex = e.NewPageIndex DataGrid1.DataBind() End Sub ??? Im not certain having not used datagrids for a while but you may nedd to reverse these two lines: ...

Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount.
I have created a data grid, and I have created the form to submit the requests to the data grid, I received the results, and I begin to page the data grid with the arrows, and I receive the following error message. Can someone help me out with this? An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [HttpException (0x80004005): Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount.] ...

Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount
Hello, I have a error in my pagin of the DataGrid. The error message is: Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount. My database have more the 10 registers and my pagezise is set of 10 registers for page. This is my codebehin, please, help me. Thanks. Private Sub CarregaProdutos() 'Define a conexão Dim Conn As New OleDbConnection(ConfigurationSettings.AppSettings("ConnectionString")) 'Define a instrução sql Dim SQL As String SQL = "SELECT Produtos.ID_Produto, Produtos.Nome, Produtos.Descricao, Produt...

Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount. #4
Hi, Error occured when i search using page 2 of datagrid and another result i wan search only return 1 page. For specific clarification reply me. Following is the code...Private Sub bindData() 'to bind data from database to datagrid dg_name.DataSource = cust.getSearchCust(tb_name.Text) dg_name.DataBind() End SubPrivate Sub btn_search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_search.Click 'to search for custData based on coName Dim num As String Dim i As Double If num <> config.dataReader2("select * from cus...

Mass deleted on DG last page gives invalid currentpageindex value
We have a "Check All" button on our v1.1 datagrid, and if the user is on the last page of the datagrid, hits "Check All" and then hits the "Delete Checked Items", we get the following error (which doesn't happen if they delete all of the first or middle pages...only the last page):Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount. Below is the code for the mass delete button click and the rebuilding of the datagrid: 'Loop through all the datagrid itemsDim Message As String = "You have selected: " Try   s...

Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount #3
I get this error right before my datagrid's Databind() method is called...what do i need to do to fix this??? any help on this issueGive Yourself a round of applause!DLPDeveloper This usually happens when you have the page index set to something and the rebind it with another dataset that causes the pageindex to be out of range.  Make sure you are setting it to 0 before binding.C# / C++ Developer Hello my friend, This happens when you specifiy a page that is greater than the number of pages in the set.  If your datagrid has a PageSize of 10, and the grid has 100 records ...

ERROR Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount.
Hi... i am using repeator and datagrid. repeator contan catagories and datagrid contains Products.. its works by that when i click catagories which is asp:Link, in the Repeater1_ItemCommand event i set the value of prepared SQL parameter in command object and bind the data to the datagrid. this show the products in datagrid of the catagory.. i enabled paging in datagrid and on Event DataGrid1_PageIndexChanged -- DataGrid1.CurrentPageIndex = e.NewPageIndex ; DataGrid1.DataBind(); -- when i click on page 2 of current product i got this error Invalid CurrentPageIn...

Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount. #2
i have a datagrid with paging enabled. i am using dataview as the datasource for the datagrid so i can filter data. paging works fine so as filtering. but if i go to next page (other than first page) and apply filter, i get the above error. any help will be appreciated.-keeara g------------------ This is a common problem, when e.g. deleting the last record in the second Page of your paged DataGrid. What happens? You are trying to rebind the DataGrid, using the last PageIndex (1 - you know Second Page), but there are no more records in this page, so you need to decrease your PageIndex...

Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount. #3
Hi I am getting the following error Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount. My current page index is 1 and page count is 0 the code I use is: private void Paging_DataGrid(object source, System.Web.UI.WebControls.DataGridPageChangedEventArgs e)         {            dg.CurrentPageIndex = e.NewPageIndex;            dg.DataBind();          } I have used this same code on another page and it worked. c...

Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount #2
I receive the following message: Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount.Nothing seems to work I have tried some advices such as setting the CurrentPageIndex = 0, and SelectedIndex = -1, I also tried to create an if statement to check if the CurrentPageIndex>10, then set it to 0, but that doesn't work either. Can anyone find out the problem I would appreciate it. Here is the code: <%@ Page Language="C#" Debug="true" Inherits="ONEnet.ONEnetPage" Src="ONEnet_shared.aspx.cs" %> <%@ import Namespace="System.Data" %> <%@ import Namespace="Sys...

Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount. #5
Hi all, Im having a datagrid with 10 pages In datagrid paging,i gave page number for navigation.  Datagrid displays records and wen i navigate to page 2, it shows the error Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount. How can i rectify that..  Cn u pls show wer the error is???   Private Sub bt_Search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_Search.Click mess.CurrentPageIndex = 0 Dim StrSql As String = "select Count(Message) from Message where UserName='" & smsuser & "&#...

Web resources about - Delete last row in the last page in dg cause Invalid CurrentPageIndex value. It must be >= 0 and < the PageCount. - asp.net.presentation-controls

Windows Web Hosting Gallery
Microsoft Windows Web hosting offers from hundreds of partners worldwide. The Microsoft Web Hosting Gallery contains the best shared, virtual, ...

Resources last updated: 1/21/2016 12:37:25 AM