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

HowTo Populate unbounded columns

0 Answers 25 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Giovanni
Top achievements
Rank 1
Giovanni asked on 20 Apr 2011, 03:08 PM
Hi, on my xaml page I have a RadGridView called ProgettiStimaGrid

I have a RadGridview which is binding to a DomainDataSource. The RadGridView has eight columns, four columns are binding, the other four are not binding but must be populated by another entity.
Example:
        binded Columns                   Not binded Columns
|--------------------------------------|------------------------------------
COL1 COL2 COL3 COL4        |   COL5 COL6 COL7 ​​COL8
    8         5         4         6               0          0         0         0
(8,5,4,6 come from database, I must populate the othes four columns: 0,0,0,0)
I tried to make a query using a DomainDataSource into the RowLoaded event,
the query has three parameters that are COL1 COL2 and COL3. Then I call dds Load method
but the dds_LoadedData event not fire see code below:

private void ProgettiStimaGrid_RowLoaded(object sender, RowLoadedEventArgs e)
        {
            if (e.Row is GridViewRow && !(e.Row is GridViewNewRow))
            {
                ProgettiStima ps = e.DataElement as ProgettiStima;

                int idGruppo = ps.IDGruppo;
                int idSottogruppo = ps.IDSottoGruppo;

                DomainDataSource dds = new DomainDataSource();
                dds.Name = "dds1";
                dds.DomainContext = context;
                dds.LoadedData += new EventHandler<LoadedDataEventArgs>(dds_LoadedData);
                dds.QueryParameters.Clear();
                Parameter p1 = new Parameter();
                Parameter p2 = new Parameter();
                Parameter p3 = new Parameter();
                p1.ParameterName = "idProgetto";
                p2.ParameterName = "idGruppo";
                p3.ParameterName = "idSottogruppo";
                p1.Value = idProgetto;
                p2.Value = idGruppo;
                p3.Value = idSottogruppo;
                dds.QueryParameters.Add(p1);
                dds.QueryParameters.Add(p2);
                dds.QueryParameters.Add(p3);
                dds.QueryName = "GetVw_ProgettiStimaConsuntivoForPSGridQuery";
                dds.Load();

                e.Row.Cells[6].Content = _consuntivoprecInt;
                e.Row.Cells[7].Content = _consuntivoprecEst;
                e.Row.Cells[8].Content = _consuntivooggiInt;
                e.Row.Cells[9].Content = _consuntivooggiEst;

            }

        }

        void dds_LoadedData(object sender, LoadedDataEventArgs e)
        {
            try
            {
                vw_ProgettiStimaConsuntivo psc = (vw_ProgettiStimaConsuntivo)e.Entities.ToList()[0];
                _consuntivoprecInt = psc.consuntivoprecInt;
                _consuntivoprecEst = psc.consuntivoprecEst;
                _consuntivooggiInt = psc.consuntivooggiInt;
                _consuntivooggiEst = psc.consuntivooggiEst;
            }
            catch
            {
           
            }

        }

 


The problem is that the event dds_LoadedData not fire until the RadGridView not finisch load all rows.
How I can solve this problem ? Is ther another way to populate not binded columns from another data-source ?
Thanks
Finocchio Giovanni


No answers yet. Maybe you can help?

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