Radpanelbar expand collapse issue

4 posts, 1 answers
  1. Dhamodharan
    Dhamodharan avatar
    300 posts
    Member since:
    Sep 2010

    Posted 03 Jul 2013 Link to this post

    Hi,
    I am using radpanel bar. when i click on the panelbar item if it is open then it should be closed and next panel item should be loaded automatically , if it is closed then expand and collapse all other expanded panel items







    Thanks.
  2. Answer
    A2H
    A2H avatar
    177 posts
    Member since:
    Mar 2010

    Posted 05 Jul 2013 Link to this post

    Hello,

    Please try the following

    1) Set the below two properties of Panel bar
    ExpandMode="SingleExpandedItem" AllowCollapseAllItems="true"

    2) call the  Panelbar's OnClientItemClicked event with the below code

    function OnClientItemClicked(sender, args) {
               if (args.get_item().get_expanded() == true) {
                    args.get_item().set_expanded(true);
                }
                else {
                    args.get_item().get_nextSibling().set_expanded(true);
                    args.get_item().set_expanded(false);
                }
            }

    Let me know if you are facing any issues.

    Thanks,
    A2H
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Dhamodharan
    Dhamodharan avatar
    300 posts
    Member since:
    Sep 2010

    Posted 10 Jul 2013 Link to this post

    Hi A2H,
    It works perfect. but when i click on the expand button of last panel item in panel bar, all Panelitem get Collapsed. Can u provide a solution for that issue.



    Thanks
  5. A2H
    A2H avatar
    177 posts
    Member since:
    Mar 2010

    Posted 10 Jul 2013 Link to this post

    Hi Dhamodharan,

    I think you want to expand the previous panel item when you select the last panel item.If that is the case use the below javascript

    function OnClientItemClicked(sender, args) {
               if (args.get_item().get_expanded() == true) {
                   args.get_item().set_expanded(true);
               }
               else {
                   if (args.get_item().get_isLast()) {
                       args.get_item().get_previousSibling().set_expanded(true);
                       args.get_item().set_expanded(false);
                   }
                   else {
                       args.get_item().get_nextSibling().set_expanded(true);
                       args.get_item().set_expanded(false);
                   }
               }
           }

    If you want a functionality other than this, please explain it here. I will help you to implement that.

    Thanks,
    A2H
Back to Top