Telerik
Skip Navigation LinksHome / Community / Forums / ASP.NET AJAX > Grid > Collapse/Expand on edit

Not answered Collapse/Expand on edit

Feed from this thread
  • Thomas Mortensen avatar

    Posted on Jun 29, 2009 (permalink)

    Hi

    I hoping that someone in here can help with with my problem.

    I have a grid which are grouped and by default they should all be collapsed.

    Then if i expand one group i get the items associated with that group. Thats fine.

    Each item is editable and it uses a usercontrol to handle the editing.

    BUT, when i press edit on an item (Im using code behind, so it makes postback) all group are now again collapsed.

    I can make the clicked item appear in its group but not the whole group or nor the usercontrol to edit the clicked item in.

    Any way to make this happen?

    Thanks in advance

    Reply

  • Shinu MVP Shinu's avatar

    Posted on Jun 29, 2009 (permalink)

    Hi Thomas,

    I hope the the GridGroupHeader is getting collapsed once you click the edit button. If so you may try the following code snippet to keep the Grouped row expanded on performing edit.

    CS:
     
      protected void RadGrid1_PreRender(object sender, EventArgs e) 
        { 
            foreach (GridGroupHeaderItem groupHeader in RadGrid1.MasterTableView.GetItems(GridItemType.GroupHeader)) 
            { 
                GridItem[] children = groupHeader.GetChildItems(); 
                foreach (GridItem child in children) 
                { 
                    if (child.Edit == true
                        groupHeader.Expanded = true
                } 
            } 
           
          
           
        } 


    Regards
    Shinu.

    Reply

  • Thomas Mortensen avatar

    Posted on Jun 29, 2009 (permalink)

    Hi Shinu,

    Thanks for the answer.
    That was very helpful and I almost got it.

    Now the whole group is expanded but i can still not see my editform which is a usercontrol I load from codebehind on "OnItemCommand".

    If I add GroupsDefaultExpanded = false the group are collapse when the page opens and when i Expand one group the others are still collapse.
    The problems is just that when I use this setting my editform wont show up and if I switch to GroupsDefaultExpanded = true or not adding it at all my form shows but the other groups are also expanding.

    Any way i can my form appear? or collapsing the other groups without use the mentioned setting.

    Thanks again

    Reply

  • Telerik Admin admin's avatar

    Posted on Jul 2, 2009 (permalink)

    Hi Thomas,

    Indeed when you choose GroupsDefaultExpanded = true (default value for this property) the grid groups will be shown as expanded on initial load and when you edit an arbitrary grid item. This behavior is by design.

    If you would like to have several groups expanded and keep their state on edit action, you may consider Shinu's approach or the solution presented in the code library thread linked below:

    http://www.telerik.com/community/code-library/aspnet-ajax/grid/persist-groups-expanded-state-on-rebind.aspx (note that the edit operation triggers implicit rebind for the grid)

    Also verify that you have set GroupLoadMode to Server when using the second approach.

    Kind regards,
    Sebastian
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.

    Reply

Back to Top

Skip Navigation LinksHome / Community / Forums / ASP.NET AJAX > Grid > Collapse/Expand on edit
Related resourses for "Collapse/Expand on edit"

ASP.NET Grid Features  |  Documentation  |  Demos  |  Telerik TV  |  Self-Paced Trainer  |  Step-by-step Tutorial  ]

Powered by Sitefinity ASP.NET CMS

Contact Us | Site Feedback | Terms of Use | Privacy Policy
Copyright © 2002-2010 Telerik. All rights reserved.