Load Does Not Reload

5 posts, 1 answers
  1. Jill
    Jill avatar
    20 posts
    Member since:
    Nov 2010

    Posted 24 Jan 2011 Link to this post

    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?
  2. Jill
    Jill avatar
    20 posts
    Member since:
    Nov 2010

    Posted 24 Jan 2011 Link to this post

    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;
            }
  3. DevCraft banner
  4. Answer
    Tai
    Tai avatar
    73 posts
    Member since:
    Jun 2010

    Posted 24 Jan 2011 Link to this post

    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...............
  5. Jill
    Jill avatar
    20 posts
    Member since:
    Nov 2010

    Posted 25 Jan 2011 Link to this post

    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!
  6. Jill
    Jill avatar
    20 posts
    Member since:
    Nov 2010

    Posted 25 Jan 2011 Link to this post

    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.
Back to Top
DevCraft banner