ObjectDataSource and GridView

J

Just Me

Hi,

I am using the gridview with a business object ( just a function which
updates using a stored proc on sqo2005 ). Anyway.

Basically, the reord displayed in the grid is simple

ExpenseWeekID WeekEndingDate AmountPaid.


OK, now, when I click the edit link on the gridview, it puts the grid into
edit mode. ( Note that the ExpenseWeekID is listed as readonly as its the
primary key.

I Make my update to lets say the amountpaid and click Update. This caused
my update function to be called and the parameters are passed to the
function. these are the three already listed.

ExpenseWeekID WeekEndingDate AmountPaid.

However, the EspenseWeekID, is of course read only and the value passes is
allways ( 0 ) meaning that the update cannot work. If I then change this
from read only so that when the grid is in edit mode, and then click update
the correct value is passed to my functiona and the update workds properly.

HOWEVER, I dont want the Primarykey to be in editable mode, how can I
overcome this without having to code all this manually.

Cheers
 
J

Just Me

Actually, I think ive found the answer.

One needs to use DataKeyNames="myKey" to tell the gridview what the key is
for the displayed records. However, this should have been automatic, I
assume it was the order in which I built the components on the page. I
guess, I should have defined the datasource before I created the gridview
????
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top