473,480 Members | 1,992 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

GridView returns wrong DataItemIndex when filtered or sorted

1 New Member
Guy I could really use the help. This is driving me out of my mind. My Gridview returns the wrong rowindex after sorting or filtering. I am using a detailsview to edit the selected record however I found out I was editing the wrong record. I am using this statement to retrieve the selected record from the gridview

DetailsView1.PageIndex = GridView1.SelectedRow.DataItemIndex

however this only returns the correct index if the grid stays in the original form, meaning not sorted or filtered. I guess the statement returns the index with respect to the gridview not the actual table. First of all is this this a .NET bug? and second of all how do I retrieve the correct record to edit it in the detailsview either by getting the correct index or a key such as AssetID in my case. I am using VisualStudio 2010 Professional and the code is in VB. Please do not give me C# as I don't use it. Many thanks in advance
May 1 '10 #1
1 2561
Frinavale
9,735 Recognized Expert Moderator Expert
Is this an ASP.NET application?
May 4 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
2044
by: Paul | last post by:
Hi I have a checkbox which I am disabling in clientside code. On postback, when I try to read the checked value of the disabled checkbox the checkbox property always returns false, even if...
0
1371
by: ASP Developer | last post by:
I have a web service that returns a class when a web method is called. This class has a enum property with four values. These four values have default numbers. For example, Apple = 5 Orange...
0
1270
by: gr8beer | last post by:
The gridview rebinds data before the RowCommand or RowEditing events fire. So, if a new record is added to the underlying datasource that changes the index of the row you are trying to edit, you...
1
1475
by: s26f84 | last post by:
Hey Guys Alot of articles and alot of stuff still no answer. Please help me on this one. I need to get data out of a filterred selected row !!! ... this is how my code looks like.... On...
0
1099
by: flowk1337 | last post by:
I have a grid view with a datatable as it's datasource in VB. I can successfully import the data into the grid view and see it. I have my website set up so that the user can edit all fields at...
3
10344
by: mathewgk80 | last post by:
Hello, I would like to know how to pass values of a gridview to another page when clicking on the link field in a gridview. Please help me. regards, Mathew
2
1411
by: Knoxy | last post by:
Hi guys, I'm using a gridview to do some inline editing. The data binds okay, its goes into edit mode and cancel okay. I'm using my own custom commandName, "save", and it picks this up okay. Don't...
5
3440
by: ukfusion | last post by:
I have an sql query which has several fields and no matter how hard i try i cant get the less than statement to work....i originally tried between but that wouldnt work either. $yourpricesearch is...
0
7049
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
6912
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
7052
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,...
1
6744
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
4488
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3000
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
2989
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1304
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 ...
0
188
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.