Problem:
There is a search button, Search, in form, for searching patient info list.
The error occurs after the following steps:
1. search first time is OK, and all found the records are displayed in the
datagrid by using databind().
2. After the first-time search, I navigate the pages by clicking the page
changing arrow < or > which defined in datagrid design (of course, the page
index is chaning).
3. After the the page index changed, I clicked the search button to search
again by filling searching keys, then got the folling error in the line about
databind.
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:
Line 976: dgRegPatient.DataSource = dsRegPats
Line 977: dgRegPatient.DataKeyField = "RegKey"
Line 978: dgRegPatient.DataBind()
Line 979: lblInfo.ForeColor = System.Drawing.Color.Green
Line 980: lblInfo.Text =
dsRegPats.Tables("RegPatients").Rows.Count & " patients found"
Source File: c:\inetpub\wwwroot\Demo\PatientRegister.aspx.vb Line: 978
--------------------------
Anyone can give me a help about it? and how to add code to fix the problem?
Thanks
David 2 2099
check for CurrentPageIndex in the code.
Are u setting the PageIndex somewhere ??
-- http://pathidotnet.blogspot.com
=====
vInAypAtHi
o__
---_,>/'_------
(_) \(_)
---------------
"david" wrote: Problem: There is a search button, Search, in form, for searching patient info list. The error occurs after the following steps: 1. search first time is OK, and all found the records are displayed in the datagrid by using databind(). 2. After the first-time search, I navigate the pages by clicking the page changing arrow < or > which defined in datagrid design (of course, the page index is chaning). 3. After the the page index changed, I clicked the search button to search again by filling searching keys, then got the folling error in the line about databind.
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:
Line 976: dgRegPatient.DataSource = dsRegPats Line 977: dgRegPatient.DataKeyField = "RegKey" Line 978: dgRegPatient.DataBind() Line 979: lblInfo.ForeColor = System.Drawing.Color.Green Line 980: lblInfo.Text = dsRegPats.Tables("RegPatients").Rows.Count & " patients found" Source File: c:\inetpub\wwwroot\Demo\PatientRegister.aspx.vb Line: 978 --------------------------
Anyone can give me a help about it? and how to add code to fix the problem?
Thanks
David
did not set the page index.
For example, after I go to the next page and then search new data and bind
it to the datagrid, I got the error message.
However, If I just in the first page, I can search other data and bind it to
the datagrid without error.
DW
"vinay" wrote: check for CurrentPageIndex in the code. Are u setting the PageIndex somewhere ??
-- http://pathidotnet.blogspot.com ===== vInAypAtHi o__ ---_,>/'_------ (_) \(_) ---------------
"david" wrote:
Problem: There is a search button, Search, in form, for searching patient info list. The error occurs after the following steps: 1. search first time is OK, and all found the records are displayed in the datagrid by using databind(). 2. After the first-time search, I navigate the pages by clicking the page changing arrow < or > which defined in datagrid design (of course, the page index is chaning). 3. After the the page index changed, I clicked the search button to search again by filling searching keys, then got the folling error in the line about databind.
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:
Line 976: dgRegPatient.DataSource = dsRegPats Line 977: dgRegPatient.DataKeyField = "RegKey" Line 978: dgRegPatient.DataBind() Line 979: lblInfo.ForeColor = System.Drawing.Color.Green Line 980: lblInfo.Text = dsRegPats.Tables("RegPatients").Rows.Count & " patients found" Source File: c:\inetpub\wwwroot\Demo\PatientRegister.aspx.vb Line: 978 --------------------------
Anyone can give me a help about it? and how to add code to fix the problem?
Thanks
David This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mad Scientist Jr |
last post by:
I am getting an error in my code that references a textbox inside the
current row of my datagrid, whenever I try changing the page (paging is
enabled). This code doesn't even run unless a button in...
|
by: Clark Choi |
last post by:
I ran the sample application called Petstore from msdn.
Everything went fine until I tested Update button on the
web form to update the database through Datagrid.
I have been searching the web to...
|
by: CVerma |
last post by:
Hi,
I have an embedded datagrid within a datalist. I am not able to
perfrom paging in the datagrid. Any ideas? Here is my code:
Here is my Simplegrid.cs file:
using System;
using...
|
by: Luis Esteban Valencia |
last post by:
I have a asp.net page (C#), with a datagrid. I use template for all columns,
and have <asp:requiredfieldvalidator> in with one of the textboxes, to make
sure it's filled in. However, this...
|
by: Mad Scientist Jr |
last post by:
I am getting an error in my code that references a textbox inside the
current row of my datagrid, whenever I try changing the page (paging is
enabled). I have tried a few different notations...
|
by: Anna |
last post by:
I have a simple DataGrid that displays a list of characteristics and
allows you to edit a description for each characteristic. The query
that feeds this involves a join, as the characteristics and...
|
by: Frank |
last post by:
Hello All,
I ham using VS.NET 2003.
Have followed instructions from
http://gridviewguy.com/ArticleDetails.aspx?articleID=26 along with several
other articles to no avail. I am pulling my hair...
|
by: Jeff User |
last post by:
Hello
..NET 1.1, VS 2003, C# & asp.net
I have tried to follow msdn instructions and samples but I can not get
an event to fire for this button on the datagrid.
There has to be something obvious...
|
by: slinky |
last post by:
I found the following code to transfer datagrid data to an Excel file.
Is this written in C#?... I'm a vb.netter. I'm just not sure where to
place the code to experiment on it. Should I place it in...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |