How do I retrieve readonly values when using a DetailsView control to update a record?

Posted by lincolnk on Stack Overflow See other posts from Stack Overflow or by lincolnk
Published on 2010-03-24T19:15:52Z Indexed on 2010/03/24 19:23 UTC
Read the original article Hit count: 247

Filed under:
|

I'm using a detailsview control to update a record, however in this particular case there's only one field that can be changed out of a many. The update method for my object takes all fields as parameters. When the detailsview's updating method fires, the values for the readonly fields (those rendered as a Label) are not available in the e.NewValues collection.

I'm currently grabbing a reference to the object when the detailsview is databound (in the objectdatasource selected event handler), storing it in session and manually adding entries to the e.NewValues collection when updating fires. It works but seems kind of heavy handed.

So, is there a better way to get the read only values back into my update method? Or is there a better way of doing this altogether?

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about detailsview