GridView returns wrong DataItemIndex when filtered or sorted

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • moodisalem
    New Member
    • Apr 2010
    • 1

    GridView returns wrong DataItemIndex when filtered or sorted

    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.Pa geIndex = GridView1.Selec tedRow.DataItem Index

    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
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Is this an ASP.NET application?

    Comment

    Working...