HighTechTalks DotNet Forums  

Dynamic creation of collapsiblepanel

ASP.net Web Controls microsoft.public.dotnet.framework.aspnet.webcontrols


Discuss Dynamic creation of collapsiblepanel in the ASP.net Web Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
gopijm@yahoo.com
 
Posts: n/a

Default Dynamic creation of collapsiblepanel - 04-02-2007 , 08:22 PM






I am trying to dynamically create a Ajax toolkit CollapsiblePanel. can anybody please share a sample with me or give me some pointers
thanks,
GJM

Reply With Quote
  #2  
Old   
Jonathan Parker
 
Posts: n/a

Default Re: Dynamic creation of collapsiblepanel - 04-03-2007 , 03:04 AM






I take it you mean you want to create on of these controls:

http://ajax.asp.net/ajaxtoolkit/CollapsiblePanel/CollapsiblePanel.aspx

at runtime.

To do this replace this in the .aspx file:

<asp:Panel ID="panelExtenderContainer" runat="server">

<ajaxToolkit:CollapsiblePanelExtender ID="cpp" runat="Server"
TargetControlID="ContentPanel"
ExpandControlID="Panel"
CollapseControlID="Panel"
ScrollContents="False"
Collapsed="False"
ExpandDirection="Vertical"
SuppressPostBack="true"
TextLabelID="TextLabel"
CollapsedText="Collapsed"
ExpandedText="Opened" />

</asp:Panel>

with this in the aspx.cs file:

protected void Page_Load(object sender, EventArgs e)
{
CollapsiblePanelExtender collapsiblePanelExtender = new
CollapsiblePanelExtender();

collapsiblePanelExtender.TargetControlID = this.ContentPanel.ID;
collapsiblePanelExtender.ExpandControlID = this.Panel.ID;
collapsiblePanelExtender.CollapseControlID = this.Panel.ID;
collapsiblePanelExtender.ScrollContents = false;
collapsiblePanelExtender.Collapsed = false;
collapsiblePanelExtender.ExpandDirection =
CollapsiblePanelExpandDirection.Vertical;
collapsiblePanelExtender.SuppressPostBack = true;
collapsiblePanelExtender.TextLabelID = this.TextLabel.ID;
collapsiblePanelExtender.CollapsedText = "Collapsed";
collapsiblePanelExtender.ExpandedText = "Opended";

this.panelExtenderContainer.Controls.Add(collapsib lePanelExtender);
}

HTH

Jonathan.

<gopijm (AT) yahoo (DOT) com> wrote

Quote:
I am trying to dynamically create a Ajax toolkit CollapsiblePanel. can
anybody please share a sample with me or give me some pointers
thanks,
GJM


Reply With Quote
  #3  
Old   
jmgopi@gmail.com
 
Posts: n/a

Default Re: Dynamic creation of collapsiblepanel - 04-03-2007 , 01:51 PM



Thanks Jonathan,

I was able to do that, but when I say
collapsiblePanelExtender.Collapsed = true; I do not get anything when
I click on the extender. But on the other hand if
collapsiblePanelExtender.Collapsed = false; it works perfectly.
Also by the way I have a asp:repeater inside each of the created
collapsiblePanelExtender.
Any Idea why this is happening?

Regards,
Gopi


Reply With Quote
  #4  
Old   
Muhammad Adil
 
Posts: n/a

Default solution for Collapsible Panel .Collapsed = true ISSue - 06-18-2008 , 12:22 AM



<asp:UpdatePanel ID="upMap" runat="server" ChildrenAsTriggers="true">
<ContentTemplate>
<asp:Panel ID="pnlTitleMap" runat="server">
<asp:Image ID="imgTitleMap" runat="server" />
<asp:Label ID="lblTitleMap" runat="server">Show</asp:Label>
CMA - Map
</asp:Panel>
<asp:Panel ID="pnlContentMap" runat="server">
<asp:Image ID="imgMap" runat="server" style="border: 3px double #999; background-image: url(/Images/Icon/Loading.gif); background-position: center center; background-repeat: no-repeat;" Visible="false" />
</asp:Panel>
<cc1:CollapsiblePanelExtender ID="cpeMap" runat="server"
TargetControlID="pnlContentMap" CollapseControlID="pnlTitleMap" ExpandControlID="pnlTitleMap"
TextLabelID="lblTitleMap" CollapsedText="Show" ExpandedText="Hide"
ImageControlID="imgTitleMap" Collapsed="True" SuppressPostBack="true">
</cc1:CollapsiblePanelExtender>
</ContentTemplate>
</asp:UpdatePanel>

<script type="text/javascript" language="javascript">

function cpeMapInit() {
try {
var cpeMap = $find('<%= cpeMap.ClientID %>');
cpeMap.add_expanded(cpeMapExpanded);
cpeMap.add_collapsed(cpeMapCollapsed);
}
catch(e) {
alert(e);
}
}

function cpeMapExpanded() {
alert("Expanded");
}

function cpeMapCollapsed() {
alert("Collapsed");
}

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_pageLoaded(cpeMapInit);

</script>

thanks
regards
Adil
<a href="http://www.successcodes.us">Cheas</a>

Reply With Quote
  #5  
Old   
Muhammad Adil
 
Posts: n/a

Default solution for Collapsible Panel .Collapsed = true ISSue - 06-18-2008 , 12:22 AM



<asp:UpdatePanel ID="upMap" runat="server" ChildrenAsTriggers="true">
<ContentTemplate>
<asp:Panel ID="pnlTitleMap" runat="server">
<asp:Image ID="imgTitleMap" runat="server" />
<asp:Label ID="lblTitleMap" runat="server">Show</asp:Label>
CMA - Map
</asp:Panel>
<asp:Panel ID="pnlContentMap" runat="server">
<asp:Image ID="imgMap" runat="server" style="border: 3px double #999; background-image: url(/Images/Icon/Loading.gif); background-position: center center; background-repeat: no-repeat;" Visible="false" />
</asp:Panel>
<cc1:CollapsiblePanelExtender ID="cpeMap" runat="server"
TargetControlID="pnlContentMap" CollapseControlID="pnlTitleMap" ExpandControlID="pnlTitleMap"
TextLabelID="lblTitleMap" CollapsedText="Show" ExpandedText="Hide"
ImageControlID="imgTitleMap" Collapsed="True" SuppressPostBack="true">
</cc1:CollapsiblePanelExtender>
</ContentTemplate>
</asp:UpdatePanel>

<script type="text/javascript" language="javascript">

function cpeMapInit() {
try {
var cpeMap = $find('<%= cpeMap.ClientID %>');
cpeMap.add_expanded(cpeMapExpanded);
cpeMap.add_collapsed(cpeMapCollapsed);
}
catch(e) {
alert(e);
}
}

function cpeMapExpanded() {
alert("Expanded");
}

function cpeMapCollapsed() {
alert("Collapsed");
}

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_pageLoaded(cpeMapInit);

</script>

thanks
regards
Adil
<a href="http://www.successcodes.us">Cheas</a>

Reply With Quote
  #6  
Old   
Muhammad Adil
 
Posts: n/a

Default solution for Collapsible Panel .Collapsed = true ISSue - 06-18-2008 , 12:22 AM



<asp:UpdatePanel ID="upMap" runat="server" ChildrenAsTriggers="true">
<ContentTemplate>
<asp:Panel ID="pnlTitleMap" runat="server">
<asp:Image ID="imgTitleMap" runat="server" />
<asp:Label ID="lblTitleMap" runat="server">Show</asp:Label>
CMA - Map
</asp:Panel>
<asp:Panel ID="pnlContentMap" runat="server">
<asp:Image ID="imgMap" runat="server" style="border: 3px double #999; background-image: url(/Images/Icon/Loading.gif); background-position: center center; background-repeat: no-repeat;" Visible="false" />
</asp:Panel>
<cc1:CollapsiblePanelExtender ID="cpeMap" runat="server"
TargetControlID="pnlContentMap" CollapseControlID="pnlTitleMap" ExpandControlID="pnlTitleMap"
TextLabelID="lblTitleMap" CollapsedText="Show" ExpandedText="Hide"
ImageControlID="imgTitleMap" Collapsed="True" SuppressPostBack="true">
</cc1:CollapsiblePanelExtender>
</ContentTemplate>
</asp:UpdatePanel>

<script type="text/javascript" language="javascript">

function cpeMapInit() {
try {
var cpeMap = $find('<%= cpeMap.ClientID %>');
cpeMap.add_expanded(cpeMapExpanded);
cpeMap.add_collapsed(cpeMapCollapsed);
}
catch(e) {
alert(e);
}
}

function cpeMapExpanded() {
alert("Expanded");
}

function cpeMapCollapsed() {
alert("Collapsed");
}

var prm = Sys.WebForms.PageRequestManager.getInstance();
prm.add_pageLoaded(cpeMapInit);

</script>

thanks
regards
Adil
<a href="http://www.successcodes.us">Cheas</a>

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.