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

Load Does Not Reload

4 Answers 135 Views
DomainDataSource
This is a migrated thread and some comments may be shown as answers.
Jill
Top achievements
Rank 1
Jill asked on 24 Jan 2011, 05:44 PM
Hi Support,

When I add a new item (not using the RDDS) through my code then call the RDDS.Load() method it does not pick up the new additions. When I leave the page and come back to it, the RDDS picks up on the new item from the database and displays it in the control.

My code looks like this;
if ( win.DialogResult == true )//user selected yes.
{
    //Create new comment and set it up.
    CommentNote note = new CommentNote();
 
    note.HistoricalInfo_CreateDate = DateTime.Now;
    note.HistoricalInfo_LDateTime = DateTime.Now;
    note.HistoricalInfo_IsDeleted = false;
    note.HistoricalInfo_LAction = "I";
    note.HistoricalInfo_LUser = 0;
    note.CommentId = CurrentComment.Id;//Links to the current summary.
    note.NoteText = win.Note;
    note.NoteAuthor = 0;
    note.NoteDateTime = DateTime.Now;
 
    //Submit our new summary.
    CommentsCommentNoteDomainContext notes = new CommentsCommentNoteDomainContext();
    notes.CommentNotes.Add( note );
    notes.SubmitChanges();               
 
    //Refresh controls.
    ddsCommentNotes.QueryParameters[ 0 ].Value = CurrentComment.Id;
    ddsCommentNotes.Load();
}

Am I doing something wrong that would cause the RDDS not to reload all of the data that's now in the database and cache what is there?

4 Answers, 1 is accepted

Sort by
0
Jill
Top achievements
Rank 1
answered on 24 Jan 2011, 05:56 PM
Also in the RDDS LoadingData event I set it to refresh.
The code looks like this;
private void ddsCommentNotesLoadingData( object sender, Telerik.Windows.Controls.DomainServices.LoadingDataEventArgs e )
        {
            e.LoadBehavior = LoadBehavior.RefreshCurrent;
        }
0
Accepted
Tai
Top achievements
Rank 1
answered on 24 Jan 2011, 11:03 PM
hi

you should try to call the load after the submitchange() has been completed

so try something likes this
notes.submitchanges(onsubmitcompleted,null);
private void onsubmitcompleted (......)
{
//Refresh controls.
    ddsCommentNotes.QueryParameters[ 0 ].Value = CurrentComment.Id;
    ddsCommentNotes.Load();

}

if that doesn't work too, then you might get the same problem as me. For my scene, i have a radcombobox and a radgridview. When my radcombobox 's selected item changed( selectionchanged event fired), then the raddomaindatasource will use the radcombobox.selectedValue as its query parameter value to load the item for the radgridview. It works fine for the hotfix version 2010.3.1304.1040 but when i upgrade to the newest released one 2010.3.1314.1040 then it failed. I will post my report soon...............
0
Jill
Top achievements
Rank 1
answered on 25 Jan 2011, 09:53 PM
Hi Tai,

That worked for me. However I learned that I need to change my tatics. It seems the RDDS SubmittedChanges & SubmittingChanges events do not fire when you call the RRDS.SubmitChanges(); method.

So I will have to switch my update calls to use the method I had above like I do my inserts. That will allow me to specify my OnSubmitChanges call like you described, then reload my data. It's an issue but not so much that I will complain to much about it lol!

Thanks for your help bro!
0
Jill
Top achievements
Rank 1
answered on 25 Jan 2011, 10:16 PM
Hi Tai, All,

Ok the SubmittedChanges and SubmittingChanges events do work but you can wire them up in the XAML like all the other events. You have to specify the event. I do that in the behind the code constructor. Looks like this;

ddsProducts.SubmittedChanges += dds_SubmittedChanges;

I think maybe I stumbled across a small bug that I'm sure they have already address in the final release version they are preparing.
Tags
DomainDataSource
Asked by
Jill
Top achievements
Rank 1
Answers by
Jill
Top achievements
Rank 1
Tai
Top achievements
Rank 1
Share this question
or