Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3493136
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:50:41+00:00 2026-05-18T11:50:41+00:00

<telerik:RadGridView x:Name=rgvData CanUserFreezeColumns=False GridLinesVisibility=Horizontal IsReadOnly=False AutoGenerateColumns=False telerik:Theming.Theme=Office_Blue ItemsSource={Binding} > <telerik:RadGridView.ChildTableDefinitions> <telerik:GridViewTableDefinition /> </telerik:RadGridView.ChildTableDefinitions> <telerik:RadGridView.Columns>

  • 0
<telerik:RadGridView x:Name="rgvData" CanUserFreezeColumns="False" GridLinesVisibility="Horizontal" IsReadOnly="False" AutoGenerateColumns="False"
                         telerik:Theming.Theme="Office_Blue" ItemsSource="{Binding}" >
        <telerik:RadGridView.ChildTableDefinitions>
            <telerik:GridViewTableDefinition />
        </telerik:RadGridView.ChildTableDefinitions>
        <telerik:RadGridView.Columns>
            <telerik:GridViewDataColumn DataMemberBinding="{Binding StudentID}" Header="Category ID" />
            <telerik:GridViewDataColumn DataMemberBinding="{Binding StudentFN}" Header="Category Name" />
            <telerik:GridViewDataColumn DataMemberBinding="{Binding StudentLN}" Header="Description" />
            <telerik:GridViewDataColumn DataMemberBinding="{Binding Picture}" Header="Picture" />
        </telerik:RadGridView.Columns>
        <telerik:RadGridView.HierarchyChildTemplate>
            <DataTemplate>
                <telerik:RadGridView x:Name="RadGridView1" Loaded="rgvData_Loaded" ShowInsertRow="True"  CanUserInsertRows="True"  ItemsSource="{Binding Subjects}" CanUserFreezeColumns="False" AutoGenerateColumns="False" ShowGroupPanel="False" IsReadOnly="False">
                    <telerik:RadGridView.Columns>
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding SubjectID}" Header="Order ID" />
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding SubjectName}" Header="Employee ID" />
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding SubjectProfessor}" Header="Order Date" />
                        <telerik:GridViewDataColumn DataMemberBinding="{Binding ShipCountry}" Header="Ship Country" />
                    </telerik:RadGridView.Columns>
                </telerik:RadGridView>
            </DataTemplate>
        </telerik:RadGridView.HierarchyChildTemplate>
    </telerik:RadGridView>

MainXaml.Cs

public partial class MainWindow : Window
{
    DataAccessDataContext m_dcData;
    public MainWindow()
    {
        InitializeComponent();
        this.Loaded += new RoutedEventHandler(MainWindow_Loaded);
        this.rgvData.Items.CollectionChanged += new NotifyCollectionChangedEventHandler(Items_CollectionChanged);
        rgvData.Filtered += new EventHandler<Telerik.Windows.Controls.GridView.GridViewFilteredEventArgs>(rgvData_Filtered);
    }

    void rgvData_Loaded(object sender, RoutedEventArgs e)
    {
        var childGrid = (RadGridView)sender;
    var parentRow = childGrid.ParentRow;

    if (parentRow != null)
    {
        rgvData.SelectedItem = childGrid.DataContext;
        parentRow.IsExpandedChanged += new RoutedEventHandler(parentRow_IsExpandedChanged);
    }
     }

void parentRow_IsExpandedChanged(object sender, RoutedEventArgs e)
{
    rgvData.SelectedItem = ((GridViewRow)sender).DataContext;
}x


    void rgvData_Filtered(object sender, Telerik.Windows.Controls.GridView.GridViewFilteredEventArgs e)
    {
        DataContext = m_dcData;
        m_dcData = new DataAccessDataContext();
        m_dcData.Log = Console.Out;
        rgvData.ItemsSource = m_dcData.Students;
        rgvData.ShowInsertRow = true;
    }

    private void Items_CollectionChanged(object sender, NotifyCollectionChangedEventArgs e)
    {
        try
        {
            if (e.Action == NotifyCollectionChangedAction.Add)
            {
                foreach (Student item in e.NewItems)
                {
                    m_dcData.Students.InsertOnSubmit(item);
                }
            }
            if (e.Action == NotifyCollectionChangedAction.Remove)
            {
                foreach (Student item in e.OldItems)
                {
                    m_dcData.Students.DeleteOnSubmit(item);
                }
            }
        }
        catch (Exception s)
        { }
    }
    void MainWindow_Loaded(object sender, RoutedEventArgs e)
    {
        m_dcData = new DataAccessDataContext();
        m_dcData.Log = Console.Out;
        rgvData.ItemsSource = m_dcData.Students;
        rgvData.ShowInsertRow = true;

        rgvData.ItemsSource = m_dcData.Students;
        rgvData.ShowInsertRow = true;
    }
}

Hi I have no problem on loading the child data related to its parent source. The problem is that if I try to expand another row it loads the first data for it. Example is if I have row1 expanded it displays the correct child table but if I go to row2 and expand it, its child records are for row1. I tried looking for the answer and putting the parent_IsExpandedChanged event to handle it but still it wont display the correct data. If I try to reload the application again and try to expand row 2 or row 3. its child is correct but if i expanded another row it will display the child for row 2 or row 3. Please help what am i doing wrong

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T11:50:41+00:00Added an answer on May 18, 2026 at 11:50 am

    Your XAML looks sound, and I can’t see that the code you posted would cause a problem. Have you confirmed that the data loaded is correct? You might actually be loading the same subject data for each student.
    You can easily check by putting this code into a button click event on your window:

    IEnumerable<Student> list = (IEnumerable<Student>)this.DataContext;
    foreach(Student stu in Students)
    {
        Debug.WriteLine(stu.StudentID + ":");
        foreach(Subject sub in stu.Subjects)
        {
            Debug.WriteLine("\\t" + sub.SubjectID)
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to make template of this to be put in resource: <telerikGridView:RadGridView x:Name=MyGridView ItemsSource={Binding
Using telerik Panel Bar Html.Telerik().PanelBar() .Name(PanelBar) .BindTo(Model, mappings => { mappings.For<Category>(binding => binding .ItemDataBound((item,
I have bound a Telerik RadGridView properly with the first column being a bound
I am using telerik RadGridView control. I would like to control/style the colors of
I am using Telerik MVC grid ajax binding to show some records. While the
I am using Telerik MVC Grid, with ajax binding and I use grid editing
I am using the Telerik framework for creating a RadGridView with child elements in
I am using Telerik's RadGridView to display some data. When data in one column
I am using Telerik Silverlight RadGridView to display instrument prices. There is a column
Enviroment: Windows Forms C# 4.0 RadGridView (Telerik 2010) How do i automaticaly scroll GridView

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.