views:

283

answers:

2

I have a SPgridview in a webpart.

And i want to get the ID of the item, not the index, when i select a row. How do i do that?

Normally i would just set the DataKeyName of the gridview to "ID" or whatever the column in the table is called.

But here im not allowed to set a single datakeyname, only multiple with a stringArray.. I tried setting it to a string array with only one item, but that failed.

I feed the data inside the gridview using a SPdatasource.

Im very new to this sharepoint world..

Thanks in advance.

A: 

I have the same issue on one of our servers, but it works fine on the other. I tried everything to find why on one of the servers the DataKeyName is lost on postback but no success

+1  A: 

Hello! I had the same problem and searched 2 days for a solution. After reading this post I had the idea to check the installed updates on both servers. The server which stored the datakeynames needed the latest .NET updates. After installing .NET 3.5 SP1 the error went away!

Maybe this helps someone. ;)

Marcel
Do you know the KB article of the update that solved it?
Alex Angas
Sorry, I don't know the KB article. I only used the Windows Update function which updated my server to the newest version.
Marcel