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

[Solved] Latest RadGrid Expand collapse no longer works

1 Answer 89 Views
Grid
This is a migrated thread and some comments may be shown as answers.
VeriFone
Top achievements
Rank 1
VeriFone asked on 24 Apr 2013, 10:31 AM
we have our piece of code which worked perfectly for ExpandCollapse command until we upgraded to latest control set:
switch (e.CommandName)
                {
                    case RadGrid.ExpandCollapseCommandName:
                        {
                            gridId = (GridDataItem)e.Item;
                            ViewState["mkAccountID"] = gridId.GetDataKeyValue("mkAccountID").ToString();
                            ViewState["DecimalPlaces"] = gridId.GetDataKeyValue("DecimalPlaces").ToString();
 
                            //Set paramaters for dsAccountTID
                            dsAccountTID.SelectParameters.Clear();
                            dsAccountTID.SelectParameters.Add("mkAccountId", ViewState["mkAccountID"].ToString());
 
                            //Set paramaters for dsAccountCardSchemes
                            dsAccountCardSchemes.SelectParameters.Clear();
                            dsAccountCardSchemes.SelectParameters.Add("mkAccountId", ViewState["mkAccountID"].ToString());
 
                            if (SharedUtilities.ExpandCollapseItems(e.Item))
                                e.Canceled = true;
                        }
                        break;
            
public static bool ExpandCollapseItems(GridItem item)
   {
 
       try
       {
           // expand the grid data item that has been clicked
           // and collapse any other so that we only ever get
           // one expanded.
           foreach (GridDataItem gdi in item.OwnerTableView.Items)
           {
               if (gdi.ItemIndexHierarchical == item.ItemIndexHierarchical)
               {
                   gdi.Expanded = !gdi.Expanded;
               }
               else
               {
                   gdi.Expanded = false;
               }
           }
           return true;
       }
       catch (Exception ex)
       {
           throw new Exception("ExpandCollapseItems: " + ex);
       }
   }

While debugging everything looks correct apart from the fact that selected DetailTable doesn't expand.
Any thought's ?

1 Answer, 1 is accepted

Sort by
0
Antonio Stoilkov
Telerik team
answered on 29 Apr 2013, 06:01 AM
Hello Mark,

I have assembled a sample project based on your code which works on my side. You could take a look at the attached page in order to observe if there are any differences at your end. In order to further investigate the problem you could open a formal ticket and attach a modified version of the project which shows the unwanted behavior so we could debug it and advice you with the best possible solution.

All the best,
Antonio Stoilkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
VeriFone
Top achievements
Rank 1
Answers by
Antonio Stoilkov
Telerik team
Share this question
or