Problem loading the GridView combo boxes.

1 posts, 0 answers
  1. SivaPrasad Bevara
    SivaPrasad Bevara avatar
    73 posts
    Member since:
    Oct 2012

    Posted 07 May 2012 Link to this post

    Hi,

    I am using Telerik controls for Silverlight 5.

    I have multiple combo boxes in my grid and trying load those in the GridLoaded Event as below.
    As the Domain operations are asynchronous, I am using the Completed Event of the Loadoperation, and loading the combo box one by one.

    The problem is, the result set in the Domain service method is Ok, but in the operation completed event, I see the records from the previous request are merged with the current record set.
    Following is the Code.
    private void LoadComboBoxes()
           {
               int LookupId = 0;
               if (grid != null)
               {
                   foreach (GridViewColumn column in grid.Columns)
                   {
                       if (column is GridViewComboBoxColumn)
                       {
                           LookupId = ((GridViewComboBoxColumn)column).GridColumnLookupID;
                           if (LookupId > 0 && ((GridViewComboBoxColumn)column).ItemsSource == null)
                           {
                               LoadOperation op = _context.Load<Data>(_context.GetLookupQuery(LookupId));
                               op.Completed += new EventHandler(op_Completed);                          
                               gridcolumn = ((GVDataGridComboBoxColumn)column);                       
                               break;
                           }
                       }
                   }
               }
           }
     
           void op_Completed(object sender, EventArgs e)
           {
               if (((System.ServiceModel.DomainServices.Client.LoadOperation<CaliperUI.Web.Models.Data>)(sender)) != null)
               {
                   gridcolumn.ItemsSource = null;
                   gridcolumn.ItemsSource = ((System.ServiceModel.DomainServices.Client.LoadOperation<CaliperUI.Web.Models.Data>)(sender)).Entities;
                   LoadComboBoxes();
               }           
              
           }

    Even I tried "LoadBehavior.RefreshCurrent" in the Load operation, but its not working.

    Please help.

    Regards,
    SivaPrasad.B
Back to Top