This is a migrated thread and some comments may be shown as answers.

RadGrid, ObjectDataSource and a ReadOnly Column

3 Answers 101 Views
Grid
This is a migrated thread and some comments may be shown as answers.
DCollicott
Top achievements
Rank 2
DCollicott asked on 22 Jan 2009, 05:45 PM
Background: Version Q3 2008, VS2005, DataSet, SQL Server.

I am using a RadGrid, which uses an ObjectDataSource, which uses a DataSet. When initially created, everything works fine during updates. However, when I set a column to ReadOnly=True (it's not the PK column btw), then during an UPDATE I get the error, "Cannot insert the value NULL into column 'columnname.'" That is, when a column is set to ReadOnly=True, a null value is submitted to the update command for that column, even though a non-NULL value was displayed in the grid.

Any clues?

Thank you.

3 Answers, 1 is accepted

Sort by
0
DCollicott
Top achievements
Rank 2
answered on 22 Jan 2009, 07:47 PM
Update... I got around this by inserting a second column for each ReadOnly column, and setting these new columns to Display=False.

This certainly is not my desired solution, though, as it is my preference to not have my code posted at TheDailyWTF some day.
0
Accepted
Rosen
Telerik team
answered on 23 Jan 2009, 07:34 AM
Hi,

When a column is readonly but its value is needed to updating/inserting you may set its ForceExtractValues property to Always.

Please give it a try and let us know about the result.

Best wishes,
Rosen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
DCollicott
Top achievements
Rank 2
answered on 23 Jan 2009, 02:25 PM
BINGO!  That's it. Thank you very much from a very happy new customer.
Tags
Grid
Asked by
DCollicott
Top achievements
Rank 2
Answers by
DCollicott
Top achievements
Rank 2
Rosen
Telerik team
Share this question
or