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

Problem loading the GridView combo boxes.

0 Answers 40 Views
GridView
This is a migrated thread and some comments may be shown as answers.
SivaPrasad Bevara
Top achievements
Rank 1
SivaPrasad Bevara asked on 07 May 2012, 12:12 PM
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

No answers yet. Maybe you can help?

Tags
GridView
Asked by
SivaPrasad Bevara
Top achievements
Rank 1
Share this question
or