Child Template Clickable but unable to insert or add data into it (Unbound Radgridview)

1 Answer 72 Views
GridView
Leenah
Top achievements
Rank 1
Iron
Leenah asked on 30 Mar 2022, 08:56 PM | edited on 31 Mar 2022, 05:37 AM

 

Hello,

I have an unbound hierarchical radgridview that has a parent template and two child templates. The master templates work fine, I can insert, type or paste data. But in the child template, I cannot add any data or rows. It remains blank. Can you tell me what I am doing wrong?

My code are below.

Sorry I am using UI Winform

Thank you in advance.

 

private void TestForm_Load(object sender, EventArgs e)
        {            
         // Setup the Master Template
                RadGrid.MasterTemplate.Columns.Add          (new GridViewTextBoxColumn("Name"));
                RadGrid.MasterTemplate.Columns.Add          (new GridViewTextBoxColumn("Description"));
                RadGrid.MasterTemplate.Columns.Add          (new GridViewDateTimeColumn("Date"));
                RadGrid.MasterTemplate.Columns.Add          (new GridViewDecimalColumn ("Value"));
                RadGrid.MasterTemplate.Columns.Add          (new GridViewTextBoxColumn("Status"));
                RadGrid.MasterTemplate.Columns.Add          (new GridViewTextBoxColumn("NameCode"));
                RadGrid.MasterTemplate.Columns.Add          (new GridViewTextBoxColumn("Event"));

                RadGrid.AllowAddNewRow                              = true;
                RadGrid.AutoGenerateHierarchy                     = true;
                RadGrid.AutoSizeColumnsMode                      = GridViewAutoSizeColumnsMode.Fill;

                //Setup Child Template
                GridViewTemplate Childtemplate                       = new GridViewTemplate();
                RadGrid.MasterTemplate.Templates.Add         (Childtemplate );
                Childtemplate.AllowAddNewRow                         = true;
                Childtemplate.AutoSizeColumnsMode                 = GridViewAutoSizeColumnsMode.Fill;

                Childtemplate.Columns.Add                                (new GridViewTextBoxColumn  ("Name"));
                Childtemplate.Columns.Add                               (new GridViewTextBoxColumn  ("Description"));


                //Relation between Parent & child
                GridViewRelation relation                            = new GridViewRelation(RadGrid.MasterTemplate);
                relation.ParentTemplate                              = RadGrid.MasterTemplate;
                relation.ChildTemplate                               = Childtemplate;

                relation.ParentColumnNames.Add("Name");
                relation.ParentColumnNames.Add("Description");
                relation.ParentColumnNames.Add("PtDate");
                relation.ParentColumnNames.Add("Value");
                relation.ParentColumnNames.Add("Status");
                relation.ParentColumnNames.Add("NameCode");
                relation.ParentColumnNames.Add("Event");

                relation.ChildColumnNames.Add ("Name");
                relation.ChildColumnNames.Add ("Description");


                RadGrid.Relations.Add(relation);

 //load data
                LoadUnboundData();

        }

private void LoadUnboundData()
{
 
                using (RadGrid.DeferRefresh())
                    {
                     TestDataSet Processes                              = new TestDataSet();
                
                    using ( RadGrid.DeferRefresh())
                    {
                     GridViewTemplate firstLevelTemplate                        =  RadGrid.MasterTemplate.Templates[0];
 
                        for (int i = 0; i < Processes.AllProcesses.Count; i++)
                        {
                    
                        TestDataSet.AllProcessesRow ProcessRow         = Processes.AllProcesses[i];
                       
                         RadGrid.MasterTemplate.Rows.Add(
                             ProcessRow.Name,
                             ProcessRow .Description, 
                             ProcessRow.Date, 
                             ProcessRow .Value,
                             ProcessRow .Status, 
                             ProcessRow .NameCode,
                             ProcessRow .Event
                                );
                        
                        for (int j = 0; j < Processes.ProcessTasks.Count; j++)
                        {
                         TestDataSet.ProcessTasksRow TasksRow     = Processes.ProcessTasks[j];
                     
                         firstLevelTemplate.Rows.Add(
                             TasksRow.Name,
                             TasksRow.Description
                                );
                        }
                        }                                  
                    }
                }
        }

 

                                                    

1 Answer, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 04 Apr 2022, 08:25 AM
Hello, Leenah, 

Your question has already been answered in the other thread you have opened on the same topic. Please, see our answer there for more information.
We kindly ask you to use just one thread for a specific problem to contact us. Posting the same questions numerous times slows down our response time because we will need to review and address two or more tickets instead of one. Moreover, threads are handled according to license and time of posting, so if it is an urgent problem, we suggest you use a support ticket, which would be handled before a forum thread.

Thank you for your understanding.

Regards,


Dess | Tech Support Engineer, Principal
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
GridView
Asked by
Leenah
Top achievements
Rank 1
Iron
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or