473,472 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Paging related problems

Hi,

I have successfully set Paging in one of my DataGrids...

But I have a problem, when I use this code:

//************************** Code
private void dgMyDataGrid_ItemCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e) {

int _ID = -1;
_ID = int.Parse(dgMyDataGrid.DataKeys[e.Item.ItemIndex].ToString());

// My DB stuff using _ID

}
//************************** Code

When I load second page of DataGrid I have this error:

Index was out of range. Must be non-negative and less than the size of
the collection. Parameter name: index

And the 'wrong' line of code is:

_ID = int.Parse(dgMyDataGrid.DataKeys[e.Item.ItemIndex].ToString());

Any idea ?

TIA
Nov 19 '05 #1
0 775

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Coleen | last post by:
Sorry about the multi-posting, but it does not seem as though the other newsgroups are frequented enough to get any advice on this problem...If anyone can possibly help, I would greatly appreciate...
2
by: Maziar Aflatoun | last post by:
Hi, I'm having problems with Custom Paging. Most of the articles out there show that the custom paging is done as the following article. ...
1
by: Danny Ni | last post by:
Hi, We use ASP.Net datagrid paging a lot and we have been experiencing "Index out of bound" error messages when we click on rows of datagrid on differnet pages every now and then. The...
2
by: Luis Esteban Valencia | last post by:
I have a data grid control with a templated checkbox column residing in a asp.net user control. The checkbox boolean state determines if the item is later added or removed from another database...
8
by: Matthew Curiale | last post by:
I am creating an app that lists clients of a company for management of different attributes for that company. The first page is a listing of the companies currently in the database. I have my...
3
by: GD | last post by:
Got a simple ASPX page (.NET v1.1) with a DataGrid displaying a list of widgets. If the page has a QueryString called WidgetId specific, I need to automatically mark the specific DataGridItem as...
1
by: Maria | last post by:
Hi, I have read about paging, segmentation and paged segmentation and I believe I have (nearly) understood how these techniques are implemented in hardware. However, I am till confused about the...
6
by: Nathan Sokalski | last post by:
I have tried everything I can think of, I have even tried copying examples from books and websites I have found, but every Formview control that I have tried to create does not show the Paging...
18
by: daveeboi | last post by:
When running the script below I am able to get all related table results and display them the way I want. When it came to my paging script I entered and limited the rows per page to 2 (for a 3...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.