Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
750
Web panel in a web user control
posted

I'm attempting to make a web user control that has a checkbox and a web panel in it. 

My goal is to have the a shopping cart sort of list.  you check the box to buy something and if you want to see some more details about the product, you expand the web panel.

I want to use a web user control since the data will be populated by a data base. 

Anyway, I get the everything to populate, but I can't seem to get the expanding/collasping to work at all.

the code is pretty simple, I think and I'm probably missing something simple.  Can someone point out my mistake?

thank you ,

Gene

>>>>Code.

public partial class CheckBoxWithPanelUC : System.Web.UI.UserControl
{
  SelectedPlanDetails m_spd;
  public CheckBoxWithPanelUC()
  {
    m_spd = null;
  }
 
  public CheckBoxWithPanelUC(SelectedPlanDetails spd)
  {
    m_spd = spd;
    CheckBox1 = new CheckBox();
    CheckBox1.Text = m_spd.m_planDetails;
    CheckBox1.Checked = m_spd.m_selected;
    WebPanel1 = new Infragistics.WebUI.Misc.WebPanel();
    WebPanel1.LoadPreset(@"C:\Program Files (x86)\Common Files\Infragistics\Presets\20081\CLR2x\Web\WebPanel\Standard\Visual Studio 2005.xml", true);
    WebPanel1.Text = "Details";
    WebPanel1.ExpandedStateChanged += new Infragistics.WebUI.Misc.WebPanel.ExpandedStateChangedEventHandler(WebPanel1_ExpandedStateChanged);
    Label1 = new Label();
    Label1.Text = m_spd.m_copy;
    PlaceHolder1 = new PlaceHolder();
  }

  protected void Page_Load(object sender, EventArgs e)
  {
    WebPanel1.Controls.Add(Label1);
    PlaceHolder1.Controls.Add(CheckBox1);
    PlaceHolder1.Controls.Add(WebPanel1);
    Controls.Add(PlaceHolder1);
  }

  protected void WebPanel1_ExpandedStateChanged(object sender, Infragistics.WebUI.Misc.WebPanel.ExpandedStateChangedEventArgs e)
  {
    int a = 0;
  }
}