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

Enable or desable the grid row based on selected value

6 Answers 25 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ramesh
Top achievements
Rank 1
Ramesh asked on 25 Nov 2013, 04:16 PM

Hi ,
  I am using  GridViwTogglerowDetailsColumn  based on year value (2010, 2014, 2018) need to display the year related data but how do i accomplish this .

Here  I have a student marks details for year 2010 ,2014 and 2018 when   I select 2010 year node it neeed to display onlt that year marks list and remaing years need to go disable . but here displaying all years records in all rows

   In code behind i would like to write like this (x:Name="lastYear",x:Name="CurrentYear",x:Name="NextYear")
if(Year >2014)
{
  this.lastYear.Visiblity= visibilty.Collapsed;

}

But system displaying an error  "Error 1 'MasterViewDemoMVVM.StudentView' does not contain a definition for 'lastYear' and no extension method 'lastYear' accepting a first argument of type 'MasterViewDemoMVVM.StudentView' could be found (are you missing a using directive or an assembly reference?) C:\Users\mandapellyr\Documents\Visual Studio 2012\Projects\MasterViewDemoMVVM\MasterViewDemoMVVM\StudentView.xaml.cs 41 22 MasterViewDemoMVVM
 "
How can i over come this

Kindly help me .

<UserControl x:Class="MasterViewDemoMVVM.StudentView"
              
              xmlns:VM="clr-namespace:MasterViewDemoMVVM"
              
                  xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             
    mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
 
    <UserControl.Resources>
        <VM:ClientViewModel x:Key="VMKEY"/>
 
        <Style x:Key="LableStyle" TargetType="sdk:Label">
            <Setter Property="Width"  Value="AUTO"/>
            <Setter Property="Height" Value="Auto"/>
            <Setter Property="FontFamily" Value="Segoe UI"/>
            <Setter Property="HorizontalAlignment" Value="Left"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="Margin" Value="5,0,5,0" />
 
        </Style>
 
        <Style x:Key="TextBlockStyle" TargetType="TextBlock">
            <!--Margin="5" VerticalAlignment="Center"-->
            <Setter Property="Margin" Value="5"/>
            <Setter Property="Width" Value="Auto" />
            <Setter Property="VerticalAlignment" Value="Center" />
        </Style>
 
        <Style x:Key="TextBoxStyle" TargetType="TextBox">
            <Setter Property="Margin" Value="5,5"/>
            <Setter Property="Width" Value="120" />
            <Setter Property="HorizontalAlignment" Value="Left" />
        </Style>
 
 
 
    </UserControl.Resources>
 
 
    <Grid x:Name="LayoutRoot" Background="White">
 
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="300*" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="10" />
        </Grid.RowDefinitions>
 
        <Grid Grid.Row="0">
            <Border Name="brdrHeading">
                <Grid Margin="1">
                    <Grid.Background>
                        <LinearGradientBrush EndPoint="0.8,1" StartPoint="0.5,0">
                            <GradientStop Color="#FF00008B" Offset="-0.5" />
                            <GradientStop Color="#FFADD8E6" Offset="1" />
                        </LinearGradientBrush>
                    </Grid.Background>
                    <TextBlock Text="Student View" FontFamily="Segoe UI" FontSize="18" Margin="10,5" Foreground="White" />
                </Grid>
            </Border>
        </Grid>
        <telerik:RadGridView x:Name="dgStudentViewSummary" DataContext="{StaticResource VMKEY}" GroupRenderMode="Flat"
                             ItemsSource="{Binding ClientModel  }"
                             VerticalAlignment="Top" MaxHeight="700"
                             Margin="2"
                             ColumnWidth="Auto"
                             CanUserFreezeColumns="False"
                             telerik:StyleManager.Theme="Windows8"
                             AutoGenerateColumns="False"
                             RowIndicatorVisibility="Collapsed"
                                 CanUserDeleteRows="False"
                                 CanUserInsertRows="False"
                                 IsReadOnly="True">
 
            <telerik:RadGridView.Columns>
                <telerik:GridViewToggleRowDetailsColumn />
                <telerik:GridViewDataColumn Header="Student Name" Width="150" DataMemberBinding="{Binding StudentName}" TextAlignment="Right"/>
 
            </telerik:RadGridView.Columns>
            <telerik:RadGridView.RowDetailsTemplate>
                <DataTemplate>
                    <telerik:RadTabControl x:Name="RadTabControl1"
                                                                        Width="1550"
                                                                        HorizontalAlignment="Left"
                                                                        Margin="10"
                                                                        VerticalAlignment="Center">
                         
                        <telerik:RadTabItem Header="Student Details">
 
                            <telerik:RadGridView x:Name="dgMasterStudentViewSummary" DataContext="{StaticResource VMKEY}" GroupRenderMode="Flat"
                                                             ItemsSource="{Binding ClientModel }"
                                                             VerticalAlignment="Top" MaxHeight="700"
                                                             Margin="2"
                                                             ColumnWidth="Auto"
                                                             CanUserFreezeColumns="False"
                                                             telerik:StyleManager.Theme="Windows8"
                                                             AutoGenerateColumns="False"
                                                             RowIndicatorVisibility="Collapsed"
                                                                 CanUserDeleteRows="False"
                                                                    CanUserInsertRows="False"
                                                               IsReadOnly="True">
 
                                <telerik:RadGridView.Columns>
                                    <telerik:GridViewToggleRowDetailsColumn/>
                                    <telerik:GridViewDataColumn Header="Year"  Width="150" DataMemberBinding="{Binding Year,Mode=TwoWay}" TextAlignment="Right"/>
                                    <telerik:GridViewDataColumn Header="Address" Width="150" DataMemberBinding="{Binding ClientName}" TextAlignment="Right"/>
                                </telerik:RadGridView.Columns>
                                <telerik:RadGridView.RowDetailsTemplate>
                                    <DataTemplate>
                                        <ScrollViewer Height="200">
 
                                            <Grid VerticalAlignment="Top" Margin="5" >
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="Auto" />
                                                    <RowDefinition Height="Auto" />
                                                    <RowDefinition Height="Auto" />
                                                    <RowDefinition Height="Auto" />
                                                </Grid.RowDefinitions>
 
                                                <Grid Grid.Row="0">
 
 
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="10" />
 
                                                    </Grid.RowDefinitions>
 
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="140" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="*" />
                                                    </Grid.ColumnDefinitions>
 
                                                    
                                                    <sdk:Label Content="Year:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="1" />
                                                    <TextBlock Text="{Binding Year}" Style="{StaticResource TextBlockStyle}" Grid.Column="1" Grid.Row="1" />
 
                                                     
                                                </Grid>
 
                                                <Grid x:Name="lastYear" Grid.Row="1" Visibility="Visible">
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="10"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                    </Grid.RowDefinitions>
 
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                    </Grid.ColumnDefinitions>
 
                                                    <sdk:Label Content="Maths:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="0" />
                                                    <TextBlock x:Name="lastyearMaths" Style="{StaticResource TextBlockStyle}" Text="{Binding Maths}" TextAlignment="Right" Grid.Column="1" Grid.Row="0" />
 
                                                    <sdk:Label Content="Science:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="1" />
                                                    <TextBlock x:Name="lastYearScienceTB" Style="{StaticResource TextBlockStyle}" Text="{Binding Science}" TextAlignment="Right" Grid.Column="1" Grid.Row="1" />
 
                                                    <sdk:Label Content="English:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="2" />
                                                    <TextBlock x:Name="lastYearEnglishTB" Style="{StaticResource TextBlockStyle}" Text="{Binding English}" TextAlignment="Right" Grid.Column="1" Grid.Row="2" />
 
                                                </Grid>
 
                                                <Grid x:Name="CurrentYear" Grid.Row="2" Visibility="Visible">
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
 
 
                                                    </Grid.RowDefinitions>
 
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                    </Grid.ColumnDefinitions>
 
                                                    <sdk:Label Content="Maths:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="0" />
                                                    <TextBlock x:Name="CurrentyearMaths" Style="{StaticResource TextBlockStyle}" Text="{Binding Maths}" TextAlignment="Right" Grid.Column="1" Grid.Row="0" />
 
                                                    <sdk:Label Content="Science:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="1" />
                                                    <TextBlock x:Name="CurrentYearScienceTB" Style="{StaticResource TextBlockStyle}" Text="{Binding Science}" TextAlignment="Right" Grid.Column="1" Grid.Row="1" />
 
                                                    <sdk:Label Content="English:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="2" />
                                                    <TextBlock x:Name="CurrentYearEnglishTB" Style="{StaticResource TextBlockStyle}" Text="{Binding English}" TextAlignment="Right" Grid.Column="1" Grid.Row="2" />
 
                                                </Grid>
 
                                                <Grid x:Name="nextyear" Grid.Row="3" Visibility="Visible">
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        
                                                    </Grid.RowDefinitions>
 
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                    </Grid.ColumnDefinitions>
 
                                                    <sdk:Label Content="Maths:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="0" />
                                                    <TextBlock x:Name="NextyearMaths" Style="{StaticResource TextBlockStyle}" Text="{Binding Maths}" TextAlignment="Right" Grid.Column="1" Grid.Row="0" />
 
                                                    <sdk:Label Content="Science:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="1" />
                                                    <TextBlock x:Name="NextYearScienceTB" Style="{StaticResource TextBlockStyle}" Text="{Binding Science}" TextAlignment="Right" Grid.Column="1" Grid.Row="1" />
 
                                                    <sdk:Label Content="English:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="2" />
                                                    <TextBlock x:Name="NextYearEnglishTB" Style="{StaticResource TextBlockStyle}" Text="{Binding English}" TextAlignment="Right" Grid.Column="1" Grid.Row="2" />
 
                                                </Grid>
 
 
                                            </Grid>
                                        </ScrollViewer>
 
                                    </DataTemplate>
                                </telerik:RadGridView.RowDetailsTemplate>
                            </telerik:RadGridView>
                        </telerik:RadTabItem>
 
                        <telerik:RadTabItem Header="Teacher Details">
 
                            <telerik:RadGridView  x:Name="dgMasterTSViewSummary" DataContext="{StaticResource VMKEY}" GroupRenderMode="Flat"
                                                             ItemsSource="{Binding ClientModel }"
                                                             VerticalAlignment="Top" MaxHeight="700"
                                                             Margin="2"
                                                             ColumnWidth="Auto"
                                                             CanUserFreezeColumns="False"
                                                             telerik:StyleManager.Theme="Windows8"
                                                             AutoGenerateColumns="False"
                                                             RowIndicatorVisibility="Collapsed"
                                                                 CanUserDeleteRows="False"
                                                                    CanUserInsertRows="False"
                                                               IsReadOnly="True">
 
                                <telerik:RadGridView.Columns>
                                    <telerik:GridViewToggleRowDetailsColumn/>
                                    <telerik:GridViewDataColumn Header="Year" Width="150" DataMemberBinding="{Binding Year, Mode=TwoWay}" TextAlignment="Right" />
                                    <telerik:GridViewDataColumn Header="Address" Width="150" DataMemberBinding="{Binding ClientAddress}" TextAlignment="Right"/>
 
                                </telerik:RadGridView.Columns>
                                <telerik:RadGridView.RowDetailsTemplate>
                                    <DataTemplate>
                                        <ScrollViewer MaxHeight="300">
                                            <Grid VerticalAlignment="Top" Margin="5" >
                                                <Grid.RowDefinitions>
                                                    <RowDefinition Height="Auto" />
                                                    <RowDefinition Height="Auto" />
                                                    <RowDefinition Height="Auto" />
                                                    <RowDefinition Height="Auto" />
                                                </Grid.RowDefinitions>
 
                                                <Grid Grid.Row="0">
 
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="10" />
 
                                                    </Grid.RowDefinitions>
 
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="140" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                    </Grid.ColumnDefinitions>
 
                                                     
                                                    <sdk:Label Content="Year:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="1" />
                                                    <TextBlock Style="{StaticResource TextBlockStyle}" Text="{Binding Year}" Grid.Column="1" Grid.Row="1" />
 
                                                     
                                                </Grid>
 
                                                <Grid x:Name="lastYear" Grid.Row="1" Visibility="Visible">
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="10"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                        <RowDefinition Height="Auto"/>
                                                    </Grid.RowDefinitions>
 
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="*" />
                                                    </Grid.ColumnDefinitions>
 
                                                    <sdk:Label Content="Maths:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="0" />
                                                    <TextBlock x:Name="lastyearMaths" Style="{StaticResource TextBlockStyle}" Text="{Binding Maths}" TextAlignment="Right" Grid.Column="1" Grid.Row="0" />
 
                                                    <sdk:Label Content="Science:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="1" />
                                                    <TextBlock x:Name="lastYearScienceTB" Style="{StaticResource TextBlockStyle}" Text="{Binding Science}" TextAlignment="Right" Grid.Column="1" Grid.Row="1" />
 
                                                    <sdk:Label Content="English:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="2" />
                                                    <TextBlock x:Name="lastYearEnglishTB" Style="{StaticResource TextBlockStyle}" Text="{Binding English}" TextAlignment="Right" Grid.Column="1" Grid.Row="2" />
 
                                                </Grid>
 
                                                <Grid x:Name="CurrentYear" Grid.Row="2" Visibility="Visible">
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
 
 
                                                    </Grid.RowDefinitions>
 
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                    </Grid.ColumnDefinitions>
 
                                                    <sdk:Label Content="Maths:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="0" />
                                                    <TextBlock x:Name="CurrentyearMaths" Style="{StaticResource TextBlockStyle}" Text="{Binding Maths}" TextAlignment="Right" Grid.Column="1" Grid.Row="0" />
 
                                                    <sdk:Label Content="Science:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="1" />
                                                    <TextBlock x:Name="CurrentYearScienceTB" Style="{StaticResource TextBlockStyle}" Text="{Binding Science}" TextAlignment="Right" Grid.Column="1" Grid.Row="1" />
 
                                                    <sdk:Label Content="English:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="2" />
                                                    <TextBlock x:Name="CurrentYearEnglishTB" Style="{StaticResource TextBlockStyle}" Text="{Binding English}" TextAlignment="Right" Grid.Column="1" Grid.Row="2" />
 
                                                </Grid>
 
                                                <Grid x:Name="nextyear" Grid.Row="3" Visibility="Visible">
                                                    <Grid.RowDefinitions>
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
                                                        <RowDefinition Height="Auto" />
 
                                                    </Grid.RowDefinitions>
 
                                                    <Grid.ColumnDefinitions>
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                        <ColumnDefinition Width="Auto" />
                                                    </Grid.ColumnDefinitions>
 
                                                    <sdk:Label Content="Maths:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="0" />
                                                    <TextBlock x:Name="NextyearMaths" Style="{StaticResource TextBlockStyle}" Text="{Binding Maths}" TextAlignment="Right" Grid.Column="1" Grid.Row="0" />
 
                                                    <sdk:Label Content="Science:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="1" />
                                                    <TextBlock x:Name="NextYearScienceTB" Style="{StaticResource TextBlockStyle}" Text="{Binding Science}" TextAlignment="Right" Grid.Column="1" Grid.Row="1" />
 
                                                    <sdk:Label Content="English:" Style="{StaticResource LableStyle}" Grid.Column="0" Grid.Row="2" />
                                                    <TextBlock x:Name="NextYearEnglishTB" Style="{StaticResource TextBlockStyle}" Text="{Binding English}" TextAlignment="Right" Grid.Column="1" Grid.Row="2" />
 
                                                </Grid>
 
                                            </Grid>
                                        </ScrollViewer>
                                    </DataTemplate>
                                </telerik:RadGridView.RowDetailsTemplate>
                            </telerik:RadGridView>
 
 
                        </telerik:RadTabItem>
 
                        </telerik:RadTabControl>
                </DataTemplate>
            </telerik:RadGridView.RowDetailsTemplate>
 
        </telerik:RadGridView>
 
 
    </Grid>
</UserControl>




using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
 
 
 
using System.Collections.Generic;
using System.Collections.ObjectModel;
 
 
namespace MasterViewDemoMVVM
{
    public class ClientViewModel
    {
 
        private ObservableCollection<ModelClientName> _clintmodel;
 
        public ObservableCollection<ModelClientName> ClientModel
        {
 
 
 
            get { return _clintmodel; }
            set { _clintmodel = value; }
        }
 
        ModelClientName m;
        public ClientViewModel()
        {
            m = new ModelClientName();
 
            ClientModel = m.GetAllClient();
         
        }
 
    }
}




using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
 
 
using System.Collections.Generic;
using System.Collections.ObjectModel;
 
namespace MasterViewDemoMVVM
{
    public class ModelClientName
    {
 
 
        public string StudentName { get; set; }
        public string  StudentAddress { get; set; }
        public int Year { get; set; }
        public int Maths { get; set; }
        public int Science { get; set; }
        public int English { get; set; }
 
 
 
 
         
 
 
        public ObservableCollection<ModelClientName> GetAllClient()
 
        {
 
            ObservableCollection<ModelClientName> _clnt = new ObservableCollection<ModelClientName>();
 
            _clnt.Add(new ModelClientName() { StudentAddress = "Hyd", StudentName = "Raja", Year = 2010,Maths=50,Science=50,English=50 });
            _clnt.Add(new ModelClientName() { StudentAddress = "Hyd", StudentName = "Raja", Year = 2014 ,Science=60, Maths=60, English=60 });
 
            _clnt.Add(new ModelClientName() { StudentAddress = "Hyd", StudentName = "Raja", Year = 2018, Science = 70, Maths = 70, English = 70 });
            return _clnt;
       
        }
 
 
    }
}

6 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 28 Nov 2013, 12:53 PM
Hi,

May I ask you to share more details on the code that led to this exception? Is it true that 'MasterViewDemoMVVM.StudentView' does not contain a definition for 'lastYear'? If so, why are you trying to access it that way?
What is "this.lastYear"?

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Ramesh
Top achievements
Rank 1
answered on 28 Nov 2013, 01:34 PM
   Hi Didie,

Thans  a lot for your reply .
     'MasterViewDemoMVVM.StudentView'  does contain "lastYear"
     This.lastYear is a Fream name i given  like bellow
    based on Year value i would like to do like bellow in code behind
 if(Year >2014)
{
this.lastYear.Visiblity= visibilty.Collapsed;

}

  so could i do this
Regards
Ramesh
<telerik:RadGridView.RowDetailsTemplate>
                                         <sdk:Frame x:Name="lastYear" Grid.Row="1" >
                                              here contain some controls
 
                                         </sdk:Frame >
 
                                              <Grid x:Name="CurrentYear" Grid.Row="2" Visibility="Visible">
                                             here contain some controls
                                             </Grid >
                                    <Grid x:Name="nextyear" Grid.Row="3" Visibility="Visible">
                                     here contain some controls
                                      </Grid>
 
                                    </telerik:RadGridView.RowDetailsTemplate>
0
Dimitrina
Telerik team
answered on 28 Nov 2013, 05:03 PM
Hi,

So, you are trying to make the Frame (with name "lastYear") collapsed. I am afraid this is not in control of RadGridView.

As soon the details have been loaded and you have a reference of the element, you can work with it.

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Ramesh
Top achievements
Rank 1
answered on 29 Nov 2013, 08:53 AM
  Hi Didie,

Thanks in advance for your support .

   I did not get you ,  may I requst you to  more elabration or any  code snippet .
   
 Kind Regards
Srilatha.
       
0
Dimitrina
Telerik team
answered on 29 Nov 2013, 09:03 AM
Hello,

What I meant is that you can find the element (with name "lastYear") when the row details are loaded and then you can work with it.
Please check this article as a reference.

Regards,
Didie
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for SILVERLIGHT.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
0
Ramesh
Top achievements
Rank 1
answered on 29 Nov 2013, 09:32 AM
   Hi Didie,

  Thank you so much ...... You are realy great my friend , it working fentastic . 

  bellow is my working code for , if any one needed

private void dgMasterStudentViewSummary_LoadingRowDetails_1(object sender, Telerik.Windows.Controls.GridView.GridViewRowDetailsEventArgs e)

{

 

Frame frm = e.DetailsElement.FindName("lastYear") as Frame;

 

Grid frm1 = e.DetailsElement.FindName("CurrentYear") as Grid;

 

Grid frm2 = e.DetailsElement.FindName("nextYear") as Grid;

 

 

frm.Visibility =

 

Visibility.Collapsed;

frm1.Visibility =

 

Visibility.Collapsed;

 

// frm2.Visibility = Visibility.Collapsed;

}

Warm Regards
Srilatha

Tags
GridView
Asked by
Ramesh
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Ramesh
Top achievements
Rank 1
Share this question
or