views:

47

answers:

0

Hi folks, I've made a simple custom control:

base.Style[HtmlTextWriterStyle.Position] = "absolute";

            if (this.Expanded) // If the Calendar is expanded.
                this.Style[HtmlTextWriterStyle.Display] = "block";
            else
                this.Style[HtmlTextWriterStyle.Display] = "none";

            //create the containing table
            Panel pnl = new Panel();
  pnl.ID = "pnl_" + this.ClientID;
            pnl.Enabled = true;           


            SherlockIIITextBox txtCalendar = new SherlockIIITextBox();                
            txtCalendar.ID = "Cal_" + this.ClientID;

            pnl.Controls.Add(txtCalendar);

            ImageButton imgButton = new ImageButton();
            imgButton.ImageUrl = "";
            imgButton.ID = "img_" + this.ClientID;
            imgButton.BorderStyle = BorderStyle.NotSet;
            imgButton.OnClientClick = "o = document.getElementById('" + this.ClientID + "');if (o.style.display=='none'){o.style.display='block';}else{o.style.display='none';}";
            pnl.Controls.Add(imgButton);
            pnl.RenderControl(writer);

When I click the ImageButton it should render the calendar. But when I click the ImageButton nothing happens.

Anyone got an idea?