Add new row with timestamp problem

3 posts, 0 answers
  1. Babu Mannaravalappil
    Babu Mannaravalappil avatar
    15 posts
    Member since:
    Oct 2009

    Posted 24 Jan 2011 Link to this post


    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. Veselin Vasilev
    Veselin Vasilev avatar
    2992 posts

    Posted 31 Jan 2011 Link to this post

    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>>
  3. PMoransais
    PMoransais avatar
    17 posts
    Member since:
    Mar 2007

    Posted 07 Oct 2011 Link to this post

    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


Back to Top