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

RowLoaded value Cell

2 Answers 154 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Aurelio Righetti
Top achievements
Rank 1
Aurelio Righetti asked on 16 Sep 2010, 10:23 PM
Hi, i have a problem with change value of cell,I do not know if the procedure I do is correct.
I use RIA SERVICES and LINQ TO SQL.
everything works fine, RadGriView with Hierarchical, I get the result as in Fig 1
<telerik:RadGridView x:Name="radGridView1" telerik:StyleManager.Theme="Office_Blue" AutoGenerateColumns="False" IsReadOnly="True" DataLoadMode="Synchronous" IsFilteringAllowed="False">
                    <telerik:RadGridView.ChildTableDefinitions>
                        <telerik:GridViewTableDefinition>
                            <telerik:GridViewTableDefinition.Relation>
                                <telerik:PropertyRelation ParentPropertyName="OrdiniAgente" />
                            </telerik:GridViewTableDefinition.Relation>
                        </telerik:GridViewTableDefinition>
                    </telerik:RadGridView.ChildTableDefinitions>
                    <telerik:RadGridView.HierarchyChildTemplate>
                        <DataTemplate>
                            <telerik:RadGridView ItemsSource="{Binding AGECOPCOMDET}" x:Name="dettaglio" ShowGroupPanel="False" AutoGenerateColumns="false" RowLoaded="dettaglio_RowLoaded">
                                <telerik:RadGridView.Columns>
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding ArtCod}" Header="Codice" IsReadOnly="True" IsFilterable="False" IsGroupable="False" x:Name="ArtCod" UniqueName="ArtCod" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding ARTICO.ArtDes}" Header="Articolo" IsReadOnly="True" IsFilterable="False" IsGroupable="False" x:Name="ArtDes" UniqueName="ArtDes" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding AgeCopComDetQta}" Header="Quantità" IsReadOnly="True" IsFilterable="False" IsGroupable="False" x:Name="AgeCopComDetQta" UniqueName="AgeCopComDetQta" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding AgeCopComDetImpLis}" Header="Prezzo Listino" IsReadOnly="True" IsFilterable="False" IsGroupable="False" x:Name="AgeCopComDetImpLis" UniqueName="AgeCopComDetImpLis" DataFormatString="{}{0:c}" />                                  
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding AgeCopComDetPreFor}" Header="Prezzo Forzato" IsReadOnly="True" IsFilterable="False" IsGroupable="False" x:Name="AgeCopComDetPreFor" UniqueName="AgeCopComDetPreFor" DataFormatString="{}{0:c}" />
                                    <telerik:GridViewDataColumn DataMemberBinding="{Binding AgeCopComDetImpImp}" Header="Prezzo Totale" IsReadOnly="True" IsFilterable="False" IsGroupable="False" x:Name="AgeCopComDetImpImp" UniqueName="AgeCopComDetImpImp" DataFormatString="{}{0:c}" />
                                </telerik:RadGridView.Columns>
                            </telerik:RadGridView>
                        </DataTemplate>
                    </telerik:RadGridView.HierarchyChildTemplate>
                    <telerik:RadGridView.Columns>
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding AgeCopComTesId}" Header="Num.Ord." IsReadOnly="True" IsFilterable="False" IsGroupable="False" x:Name="NumOrd" />
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding AgeCopComTesDatOrd, Converter={StaticResource MyDateConverter}}" Header="Data Ord." IsReadOnly="True" DataFormatString="{}{0:d}" x:Name="DatOrd" />
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding AgeCopComTesDatCon, Converter={StaticResource MyDateConverter}}" Header="Data Cons." IsReadOnly="True" DataFormatString="{}{0:d}" TextAlignment="Center" x:Name="DatCon" IsFilterable="False" IsGroupable="False" />
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding TotOrd}" Header="Tot.Ord." IsReadOnly="True" DataFormatString="{}{0:c}" TextAlignment="Right" x:Name="TotOrd" IsGroupable="False" CellStyle="{StaticResource GridViewCellStyleBold}"/>
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding CliForRagSoc}" Header="Cliente" IsReadOnly="True" x:Name="Cliente" IsGroupable="True" />
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding AgeCopComTesRifOrdCli}" Header="Rif.Ord.Cli." IsReadOnly="True" x:Name="RifOrdCli" IsGroupable="False" IsFilterable="False" />
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding AgeCopComTesRifDatCli, Converter={StaticResource MyDateConverter}}" Header="Data Rif.Ord."  DataFormatString="{}{0:d}" IsReadOnly="True" x:Name="DatRifOrd" IsGroupable="False" IsFilterable="False" />
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding AgeCopComTesDesDes}" Header="Destinatario" IsReadOnly="True" x:Name="Destinatario" IsGroupable="False" IsFilterable="False" />
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding AgeCod}" Header="Agente" IsReadOnly="True" x:Name="Agente" IsGroupable="True" IsFilterable="True" />
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding AgeCopComTesStaLog}" Header="Status" IsReadOnly="True" x:Name="Status" IsFilterable="True" IsVisible="False" />
                    </telerik:RadGridView.Columns>           
                </telerik:RadGridView>

If the cell of column "Prezzo Forzato" is higher than 0 I set to 0 the cell of column "Prezzo Listino", in this esample, the first row have a "Prezzo Forzato" = € 4,00 and i set the cell "Prezzo Listino" = €0,00.
I do not know how to do this.
I tried to do this dettaglio_RowLoaded is the grid of data template:
private void dettaglio_RowLoaded(object sender, RowLoadedEventArgs e)
        {
            if (e.DataElement != null)
            {
                var dettaglio = e.DataElement as AGECOPCOMDET;
                var row = e.Row as GridViewRow;
           if (row != null)
         {
                if (dettaglio.AgeCopComDetPreFor != 0)            
                   
                    {
                        row.GetCellFromPropertyName("AgeCopComDetImpLis").Value = 0;
                     
                    }
 
                }
 
            }
        }

But is don't work,
I get no errors, but I get a white screen as in fig.2
 

Dizionario - Visualizza dizionario dettagliato

  1. sostantivo
    1. everything
    2. anything
    3. whole shoot
  2. aggettivo
    1. all
    2. whole
    3. any
    4. every
    5. each one
    6. each

If comment the line:
row.GetCellFromPropertyName("AgeCopComDetImpLis").Value = 0;
is work, but don't change the value of cell "Prezzo Listino" to 0.
How do I change the price of the cell  "Prezzo Listino" when the cell "Prezzo Forzato" is > 0 ?

Tnks
Aurelio

2 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 17 Sep 2010, 06:25 AM
Hello,

 You can use the approach demonstrated on this demo

Best wishes,
Vlad
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Aurelio Righetti
Top achievements
Rank 1
answered on 17 Sep 2010, 09:13 PM
Hi Vlad tnks is work fine, i use the CellSelector is fantastic !!!!!

Aurelio
Tags
GridView
Asked by
Aurelio Righetti
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Aurelio Righetti
Top achievements
Rank 1
Share this question
or