christ2
asked on
CollapsiblePanelExtender Panel is opening but is not collapsing
Hello I have a CollapsiblePanelExtender added in the code behind.
It works, the content panel opens clicking on the header. Picture is switching.
until this point everything is fine. But when I click to close the contentpanel. The panel does not close.
Someone who can give me a idea, what I missed.
if I add this Javascript and a event to the image
oImage.OnClientClick = "return ExpandCollapse();";
"function ExpandCollapse()"+
"{" +
" var collPanel = $find('CollapsiblePanelExt ender1');" +
" if (collPanel.get_Collapsed() )"+
" collPanel.set_Collapsed(fa lse);"+
" else" +
" collPanel.set_Collapsed(tr ue); } "+
the panel close but a sec later it opens again.
----- Here the code -------------------------- ---------- ---------- ---------- ---------- -------
addLiteral("<td class='labelsmall' colspan='7'>");
#region CollapsedPanel
// int scriptmanager
ScriptManager oScriptManager = new ScriptManager();
oScriptManager.ID = "ScriptManager1";
this.Form1.Controls.Add(oS criptManag er);
// PlaceHolder init
PlaceHolder oPlaceHolder = new PlaceHolder();
// Ein Panel für den Titel
Panel oPanelTitle = new Panel();
oPanelTitle.ID = "pnlTitle";
oPanelTitle.CssClass = "cpHeader";
// Imagebutton, der den Collapse steuert
System.Web.UI.WebControls. ImageButto n oImage = new System.Web.UI.WebControls. ImageButto n();
oImage.ID="PanelTitleImage " ;
oImage.ImageUrl="~/pic/exp and.jpg" ;
oPanelTitle.Controls.Add(o Image);
// Header Label
Label oLabel = new Label();
oLabel.ID = "PanelTitleLabel";
oPanelTitle.Controls.Add(o Label);
// ContentPanel erzeugen
Panel oPanelContent = new Panel();
oPanelContent.ID = "pnlContent";
oPanelContent.CssClass = "cpBody";
// Literal für den Content
Literal oLiteral = new Literal();
oLiteral.Text = "Inserire i dati manualmente ...";
oPanelContent.Controls.Add (oLiteral) ;
// CollapsiblePanelExtender erzeugen
CollapsiblePanelExtender oCollapseExt = new CollapsiblePanelExtender() ;
oCollapseExt.ID = "CollapsiblePanelExtender1 ";
oCollapseExt.TargetControl ID = "pnlContent";
oCollapseExt.ExpandControl ID = "pnlTitle";
oCollapseExt.CollapsedSize = 0;
oCollapseExt.CollapsedText = " Show Help";
oCollapseExt.ExpandedText = " Hide Help";
oCollapseExt.CollapsedImag e = "~/pic/expand.jpg";
oCollapseExt.ExpandedImage = "~/pic/collapse.jpg";
oCollapseExt.Collapsed = true;
oCollapseExt.SuppressPostB ack = true;
oCollapseExt.ImageControlI D = "PanelTitleImage" ;
oCollapseExt.TextLabelID = "PanelTitleLabel";
oCollapseExt.ClientState = "true";
oCollapseExt.AutoCollapse = false;
// die Controls dem Placeholder zuordnen
oPlaceHolder.Controls.Add( oPanelTitl e);
oPlaceHolder.Controls.Add( oPanelCont ent);
oPlaceHolder.Controls.Add( oCollapseE xt);
this.Form1.Controls.Add(oP laceHolder );
addLiteral("</td>");
It works, the content panel opens clicking on the header. Picture is switching.
until this point everything is fine. But when I click to close the contentpanel. The panel does not close.
Someone who can give me a idea, what I missed.
if I add this Javascript and a event to the image
oImage.OnClientClick = "return ExpandCollapse();";
"function ExpandCollapse()"+
"{" +
" var collPanel = $find('CollapsiblePanelExt
" if (collPanel.get_Collapsed()
" collPanel.set_Collapsed(fa
" else" +
" collPanel.set_Collapsed(tr
the panel close but a sec later it opens again.
----- Here the code --------------------------
addLiteral("<td class='labelsmall' colspan='7'>");
#region CollapsedPanel
// int scriptmanager
ScriptManager oScriptManager = new ScriptManager();
oScriptManager.ID = "ScriptManager1";
this.Form1.Controls.Add(oS
// PlaceHolder init
PlaceHolder oPlaceHolder = new PlaceHolder();
// Ein Panel für den Titel
Panel oPanelTitle = new Panel();
oPanelTitle.ID = "pnlTitle";
oPanelTitle.CssClass = "cpHeader";
// Imagebutton, der den Collapse steuert
System.Web.UI.WebControls.
oImage.ID="PanelTitleImage
oImage.ImageUrl="~/pic/exp
oPanelTitle.Controls.Add(o
// Header Label
Label oLabel = new Label();
oLabel.ID = "PanelTitleLabel";
oPanelTitle.Controls.Add(o
// ContentPanel erzeugen
Panel oPanelContent = new Panel();
oPanelContent.ID = "pnlContent";
oPanelContent.CssClass = "cpBody";
// Literal für den Content
Literal oLiteral = new Literal();
oLiteral.Text = "Inserire i dati manualmente ...";
oPanelContent.Controls.Add
// CollapsiblePanelExtender erzeugen
CollapsiblePanelExtender oCollapseExt = new CollapsiblePanelExtender()
oCollapseExt.ID = "CollapsiblePanelExtender1
oCollapseExt.TargetControl
oCollapseExt.ExpandControl
oCollapseExt.CollapsedSize
oCollapseExt.CollapsedText
oCollapseExt.ExpandedText = " Hide Help";
oCollapseExt.CollapsedImag
oCollapseExt.ExpandedImage
oCollapseExt.Collapsed = true;
oCollapseExt.SuppressPostB
oCollapseExt.ImageControlI
oCollapseExt.TextLabelID = "PanelTitleLabel";
oCollapseExt.ClientState = "true";
oCollapseExt.AutoCollapse = false;
// die Controls dem Placeholder zuordnen
oPlaceHolder.Controls.Add(
oPlaceHolder.Controls.Add(
oPlaceHolder.Controls.Add(
this.Form1.Controls.Add(oP
addLiteral("</td>");
ASKER
I tested the code
for chrome. Problem as described. CSS is working
for Firefox. Problem as described. CSS is NOT working
for IE8: IE opens the Content panel if I open the page and I can't close it. CSS is working.
for chrome. Problem as described. CSS is working
for Firefox. Problem as described. CSS is NOT working
for IE8: IE opens the Content panel if I open the page and I can't close it. CSS is working.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER