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

Setting flield values with CRUD operations

2 Answers 87 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
zanekevin
Top achievements
Rank 1
zanekevin asked on 21 Jul 2011, 11:25 PM
I am using the  <telerik:RadDataForm.EditTemplate> and <telerik:RadDataForm.NewItemTemplate>.
I would like to set a couple of fields (MODIFIED_BY/TIMESTAMP) to the system date and modified_by user in the code behind before I do a DomainDataSource.SubmitChanges.
I was thinking it would be in the event EditEnded to set the current record being edit to the updated time stamp.
This is not that hard. Seems that I am just plexed in Silverlight/WCF RIA Services.
Mayby I am still thinking asp.net

2 Answers, 1 is accepted

Sort by
0
Ivan Ivanov
Telerik team
answered on 22 Jul 2011, 07:31 AM
Hi Zanekevin,

Please, refer to this demo. It illustrates utilization of RadDataForm with RIA and RadDomainDataSource. I think it might prove useful to you. Please, do not hesitate to contact us immediately if any further inquires occur.

All the best,
Ivan Ivanov
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
zanekevin
Top achievements
Rank 1
answered on 22 Jul 2011, 10:21 PM
I did see this DEMO. I does not address the issue of setting a EDIT CurrentItem to a default value, so the User on the Client does not enter the data.

But Still confused on how to set a couple of fields values on UPDATING OR INSERTING data using the RadDataForm in the CODE BEHIND Events of the ADD/EDIT of the RadDataForm.

From my Entity (bottom) CurrentItem the two fields that the user will not Add or Edit would be the 'MODIFIED_BY' and 'TIME_STAMP', Iwould like to set field values before a DomainDataService.SubmitChanges()

My thoughts on how this works in a sample below is:

private RadDataForm_EndEditing(object sender, Telerik.Windows.Controls.Data.DataForm.EditEventsArgs e)
{
    MyRadDataForm.[MODIFIED_BY] = 'John Doe';
    MyRadDataForm.[TIME_STAMP] = DateTime.now();
    DomainDataService.SubmitChanges();

    OR

    MyRadDataForm.CurrentItem.MODIFIED_BY = ' = 'John Doe';
    MyRadDataForm.CurrentItem.TIME_STAMP = DateTime.now();
    DomainDataService.SubmitChanges();
}

/* Entity */

CREATE

 

 

TABLE BENEFITS_MSTR (

 

REC_ID

 

NUMBER,

 

ORG_ID

 

VARCHAR2(15 BYTE),

 

LBR_GRP

 

VARCHAR2(3 BYTE),

 

MODIFIED_BY

 

VARCHAR2(30 BYTE),  -- User does not touch this field, information display only

 

TIME_STAMP

 

DATE          -- User does not touch this field, information display only

 

)

Tags
DataForm
Asked by
zanekevin
Top achievements
Rank 1
Answers by
Ivan Ivanov
Telerik team
zanekevin
Top achievements
Rank 1
Share this question
or