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

Problem with Dynamic Child Grid data binding with RowSourceNeeded

4 Answers 42 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Elad
Top achievements
Rank 1
Elad asked on 08 Jul 2014, 12:01 PM
Hi Team, 
I am new to Telerik Grid Control for Winforms. i am using trial version 2014.1.402.40 Run time version : v4.0.30319. 
Basically i am using the Grid in below described picture mode. where i have 2 tables , 1 for Main Grid data binding LineItem & 2 for Child Grid data binding to make bundles of LineItems.  I have created these datatables  and relation from the Objects and it works fine when it loads the data first time from Objects. 
Now i have given a functionality to add new LineItems on the fly by creating the Table records in the dataset under the LineItem Table that works perfectly fine. 
I have another functionality to create bundle on the fly by selecting at least 2 rows in the grid and right click on the First Cell to open a custom context menu on the Grid. 
When i do that action and update both the tables with appropriate records and then try to expand the  new row control crashes. 
I can see in the first call of RowSourceNeeded when the new Row created it does not bring data from relation table. 
I tried calling the same function by code with the new created record after table commits and it brought the data from relation and binded as well but the expand still crashes. 
Can some please help  ? 

Please let me know in case if some thing is not clear. 

4 Answers, 1 is accepted

Sort by
0
George
Telerik team
answered on 11 Jul 2014, 09:38 AM
Hi Elad,

Thank you for writing.

I tried to reproduce the issue at hand, however, it seems to work good on my end. You can find my sample project attached below. Feel free to modify it in a way that the issue is reproducible so I can continue investigating the case at hand.

Looking forward to your response.

Regards,
George
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
0
Elad
Top achievements
Rank 1
answered on 11 Jul 2014, 12:54 PM
Hi George, 
Thanks for your time. As i mention earlier the Data load works perfectly first time but I have  a function on the context menu click which looks like below. Once i click on the context menu I try to add data in the both tables Main and relations, in real it show the (+) icon but when i click on it telerik control crashes. 

private void BundleContextMenuItem_Click(object sender, EventArgs e)<br>
        {<br>
                    <br>
            //11. On Bundle Click <br>
            List<DataRow> selectedRows = new List<DataRow>();<br>
            List<GridViewRowInfo> CollectionOfMovingRow = new List<GridViewRowInfo>();<br>
            //11.2.   Foreach item in Grid.SelectedRows<br>
            foreach (GridViewRowInfo dr in rgViewListItems.SelectedRows)<br>
            {<br>
                //11.2.1.   selectedRows.Add(Item.RowInfo.BoundedItem as DataRow)<br>
                selectedRows.Add((dr.DataBoundItem as DataRowView).Row);<br>
                CollectionOfMovingRow.Add(dr);<br>
            }<br>
            /// This function adds the data in both tables of DataSet <br>
            Model.AddNewBundleRow(selectedRows);<br>
            <br>
            rgViewListItems.MasterTemplate.Refresh(null);<br>
            List<GridViewRowInfo> collection=new List<GridViewRowInfo>();<br>
            rgViewListItems.CurrentRow.ChildRows.Load(CollectionOfMovingRow);<br>
            <br>
          // rgViewListItems_RowSourceNeeded(childTemplate.HierarchyDataProvider, new GridViewRowSourceNeededEventArgs(rgViewListItems.CurrentRow, childTemplate, collection));<br>
<br>
           // this.rgViewListItems.RowSourceNeeded += new GridViewRowSourceNeededEventHandler(rgViewListItems_RowSourceNeeded);<br>
           // rgViewListItems.Refresh();<br>
       <br>
                 }
0
Elad
Top achievements
Rank 1
answered on 11 Jul 2014, 12:56 PM
Also attached the Screens of the DataSet Manipulation code, I can see in that dataset everything goes good and relation made well as expected. 
0
George
Telerik team
answered on 16 Jul 2014, 12:18 PM
Hello Elad,

Thank you for writing.

Since we are discussing this matter in a private support thread we can continue our communication there. If there is anything that can help the community we will make sure to post it here as well.

Regards,
George
Telerik
 
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
 
Tags
GridView
Asked by
Elad
Top achievements
Rank 1
Answers by
George
Telerik team
Elad
Top achievements
Rank 1
Share this question
or