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

Unique Not Null Not Updating

3 Answers 21 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 28 Oct 2013, 05:41 PM
Hi All!

I have an editable RadGrid with a SQL Server 2008 back end.  I can successfully update values except when updating one field that is UNIQUE NOT NULL. 

When I insert a new item I can populate this field with no issue.

I have checked the update script in SQL Server Management Studio, and it updated the entry correctly.

Can anyone please advise me?

Thanks,
Mark

3 Answers, 1 is accepted

Sort by
0
Mark
Top achievements
Rank 1
answered on 28 Oct 2013, 06:36 PM
OK, it's definitely not the fact that that column is NOT NULL UNIQUE.

I do, on RadGrid_InsertCommand, intercept the value entered by the User, and if it is "" I enter in a temporary value, but that should have nothing to do with the update functionality . . . hmm . . .
0
Mark
Top achievements
Rank 1
answered on 28 Oct 2013, 07:44 PM
Huh, it would appear that the reason I cannot update that field is because it is the MasterKeyField.  It is also in the DataKeyNames.
0
Mark
Top achievements
Rank 1
answered on 28 Oct 2013, 08:17 PM
Figured it out!

In RadGrid_UpdateCommand I set RadGrid.MasterTableView.DataKeyNames = null.  In RadGrid_ItemUpdated I reset it.
Tags
Grid
Asked by
Mark
Top achievements
Rank 1
Answers by
Mark
Top achievements
Rank 1
Share this question
or