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

Add new row with timestamp problem

2 Answers 30 Views
This is a migrated thread and some comments may be shown as answers.
Babu Mannaravalappil
Top achievements
Rank 1
Babu Mannaravalappil asked on 24 Jan 2011, 07:36 PM

I have a RadGridView, a RadDomainDataSource, a RIA DomainService and a .NET EntityFramework Model from my SQL database.  My grid works fine; it fetches the data and displays it in the grid as expected.  The underlying table for this Entity contains a non-nullable timestamp field by the name "Modified".  I don't want to show this field in the grid and so I did not create a grid column for it.  When I press the Insert key, as expected, a new blank row is inserted in the grid.  So far, so good.  But after filling the column values, and I press tab key to lose focus from the row, I get an error saying "The 'Modified' field is required".  How can I get rid of this error.  In other words, how would I go about validating the data to elimiate the error message.  Here is my XAML for the page.  Please advise.

            xmlns:vm="clr-namespace:Library.ViewModels" />
                Width="0.731*" />
                Width="0.269*" />
                Height="0.8*" />
                Height="0.2*" />
                <ds:LibraryDataDomainContext />
            IsBusy="{Binding IsBusy, ElementName=ContributorDS}">
                ItemsSource="{Binding DataView, ElementName=ContributorDS}"
                IsBusy="{Binding IsBusy, ElementName=ContributorDS}" AutoGenerateColumns="False">
                        DataMemberBinding="{Binding PKId}"
                        IsVisible="False" />
                        DataMemberBinding="{Binding Name}"
                        Header="Name" />
                        DataMemberBinding="{Binding Description}"
                        Header="Description" />



2 Answers, 1 is accepted

Sort by
Veselin Vasilev
Telerik team
answered on 31 Jan 2011, 10:04 AM
Hello Babu Mannaravalappil,

You should handle the AddingNewDataItem event of RadGridView and set the timestamp property of the new object. You can find a sample project here.

Kind regards,
Veselin Vasilev
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Top achievements
Rank 1
answered on 07 Oct 2011, 02:32 PM
The suggestion to provide a value for the timestamp field during row creation does not sound right: in SQLServer, fields of type timestamp are calculated by the database (Computed in Entity Framework). 

The only solution I can think of is to not include the field in the data set.That could present a problem in some scenarios


Asked by
Babu Mannaravalappil
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Top achievements
Rank 1
Share this question