Looking for user collapsable panels

Ask a Question related to ASP Components, Design and Development.

  1. #1

    Default Looking for user collapsable panels

    I'm looking for a 3rd party component that is a regular container and which
    the user can open or collapse. Each needs to be able to contain buttons and
    labels.
    ChrisA Guest

  2. Similar Questions and Discussions

    1. Collapsable functions and classes like in Visual Studio andKomodo 3.1
      wyrmhaven wrote: yes indeed this would be helpful, however, it isn't built in, and I do not think that you can add it to the code viewer within...
    2. Collapsable functions and classes like in Visual Studioand Komodo 3.1
      when writing lengthy php or javascript scripts it would be very helpfull if the coder could collapse the functions so that all you see is the...
    3. viewstate for collapsable panel control
      Hi. I have built a custom control for a collapseable panel. The panel has an image to which when clicked, fires a client side javascript...
    4. Collapsable Menu Problem
      I have a collapsable menu that works well except one problem. when the clip loads the menu is closed, what I would like it to do is load the menu...
    5. Help Me With A Flash Collapsable Menu
      I am doing a web-site and I need help with doing a Flash Collapsable menu. We want it to work like the menu on the left of the Terminator 3...
  3. #2

    Default RE: Looking for user collapsable panels

    "ChrisA" wrote:
    > I'm looking for a 3rd party component that is a regular container and which
    > the user can open or collapse. Each needs to be able to contain buttons and
    > labels.
    Chris,

    For our project we had a similar requirement. We solved this by extending
    the panel class somewhat. I realise taht this may not be what you are looking
    for. Feel free to disregard this post if it's not helpfull.

    Kind regards,

    Martijn

    The code is not too big and fairly straightforward, so I'll add it below:

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Web.UI.WebControls;
    using System.Web.UI;
    using System.ComponentModel;

    namespace MyWebControls
    {
    public class MyPanel : System.Web.UI.WebControls.Panel
    {
    private ImageButton iButton = new ImageButton();
    private Label iLabel = new Label();

    public CCPanel()
    {
    iButton.Click += new ImageClickEventHandler(iButton_Click);
    this.Controls.Add(iButton);
    }

    [Bindable(true),
    Category("Appearance"),
    DefaultValue("")]
    public string label
    {
    get
    {
    return iLabel.Text;
    }
    set
    {
    iLabel.Text = value;
    }
    }

    [Bindable(true),
    Category("Appearance"),
    DefaultValue("true")]
    public Boolean open
    {
    get
    {
    Object lObject = ViewState["isOpen"];
    if (lObject != null) return (Boolean)lObject;
    return true;
    }
    set
    {
    ViewState["isOpen"] = value;
    }
    }

    protected override void OnInit(EventArgs pE)
    {
    iButton.ImageUrl = "~/_images/minus_wh.gif";
    if (Width.IsEmpty) Width = new Unit("100%");
    base.OnInit(pE);
    }

    protected override void Render(System.Web.UI.HtmlTextWriter pWriter)
    {
    pWriter.Write("<table class=\"tb_ccpanel\" width=\"" +
    Width.ToString() + "\" cellspacing=\"0\">\n");
    if (open)
    pWriter.Write("<tr class=\"tr_ccpanel_open
    tr_ccpanel_header\" style=\"" + Width.ToString() + ";\"><td
    class=\"td_ccpanel_header\">\n");
    else
    pWriter.Write("<tr class=\"tr_ccpanel_closed
    tr_ccpanel_header\" style=\"" + Width.ToString() + ";\"><td
    class=\"td_ccpanel_header\">\n");
    iButton.RenderControl(pWriter);
    pWriter.Write(" ");
    iLabel.RenderControl(pWriter);
    pWriter.Write("</td></tr>");
    iButton.Visible = false;
    if (open)
    pWriter.Write("<tr><td class=\"td_ccpanel_content\">\n");
    Visible = open;
    RenderBeginTag(pWriter);
    if (open) RenderContents(pWriter);
    RenderEndTag(pWriter);
    if (open)
    pWriter.Write("</td></tr>");
    pWriter.Write("</table>");
    }


    private void SetModeReadonly(Control pControl)
    {
    if (pControl.HasControls())
    foreach (Control lControl in pControl.Controls)
    SetModeReadonly(lControl);
    if (pControl is DetailsView)
    ((DetailsView)pControl).ChangeMode(DetailsViewMode .ReadOnly);
    if (pControl is GridView)
    ((GridView)pControl).EditIndex = -1;
    }

    private void iButton_Click(Object pSender, EventArgs pArgs)
    {
    if (open)
    {
    open = false;
    iButton.ImageUrl = "~/_images/plus_wh.gif";
    SetModeReadonly(this);
    }
    else
    {
    open = true;
    iButton.ImageUrl = "~/_images/minus_wh.gif";
    }
    }
    }
    }

    Mind that you set the image locations, "~/_images/minus_wh.gif" and
    "~/_images/plus_wh.gif" to the locations of your own images. Also, since we
    have only assigned CSS classes to the HTML table and it's elements, proper
    layout will require some additional entries in your stylesheet.
    Martijn Guest

  4. #3

    Default RE: Looking for user collapsable panels

    Martijn,
    Thanks very much for your post. I like your implementation.
    -- Chris
    ChrisA Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139