Ask a Question related to ASP Components, Design and Development.
-
ChrisA #1
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
-
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... -
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... -
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... -
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... -
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... -
Martijn #2
RE: Looking for user collapsable panels
"ChrisA" wrote:
Chris,> 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.
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
-
ChrisA #3
RE: Looking for user collapsable panels
Martijn,
Thanks very much for your post. I like your implementation.
-- Chris
ChrisA Guest



Reply With Quote

