Hi all,
I have followed the tutorial for creating an Ajax module and for the most part it seems to work except that the CollapsiblePanelExtender section. I'm not sure what I did wrong but could someone please help.
What happens is that when I click to collapse the panel it does collapse but expands again.
I have the code in an ascx file called "DemoControl.ascx" and then added this module to a page I created in the portal. I'm not sure if the problem is caused by the ajax code or the created page, if the page is finishing to reloading/refresh after the module fires then it could be resetting the module to orginal state if that is the case what would I do to fix it? I placed the code to the module below incase someone wants to review it to see if they can replicate this problem.
The DNN version is 4.08
Thanks inadvance.
Neil
DemoControl.ascx
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="DemoControl.ascx.vb" Inherits="DesktopModules_DemoApp_DemoControl" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<asp:Panel ID="PnlAjaxUpdate" runat="server" Height="50px" Width="300px">
Current time:
<asp:Label ID="lblCurrentTime" runat="server" Text="Label"></asp:Label><br />
<br />
<asp:Button ID="btnTimeUpdate" runat="server" Text="Update (Ajax)" />
<asp:Button ID="btnPostBackTimeUpdate" runat="server" Text="Update (Postback)" /></asp:Panel>
Collapsible Panel Demonstration<br />
<br />
<ajaxToolkit:CollapsiblePanelExtender ID="PanelExtender" runat="server"
TargetControlID="pnlCollapse"
CollapsedText="Click to Expand"
ExpandedText="Click to Colapse"
TextLabelID="lblAction"
CollapseControlID="pnlHeader"
ExpandControlID="pnlHeader">
</ajaxToolkit:CollapsiblePanelExtender>
<asp:Panel ID="pnlHeader" runat="server" Height="50px" Width="125px">
<asp:Label ID="lblAction" runat="server" Text="Label"></asp:Label>
</asp:Panel>
<asp:Panel ID="pnlCollapse" runat="server" Height="50px" Width="125px">
<p>content inside this panel can be expanded or collapsed by using the CollapsiblePanelExtender.</p>
<p>Additional text can be added as well as any other HTML or</p>
<p>This is the last paragraph.</p>
</asp:Panel>
DemoControl.ascx.vb
Imports DotNetNuke
Imports System.Web.UI
Imports System.Collections.Generic
Imports System.Reflection
Imports DotNetNuke.Security.PortalSecurity
Partial Class DesktopModules_DemoApp_DemoControl
Inherits DotNetNuke.Entities.Modules.PortalModuleBase
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If DotNetNuke.Framework.AJAX.IsInstalled Then
DotNetNuke.Framework.AJAX.RegisterScriptManager()
DotNetNuke.Framework.AJAX.WrapUpdatePanelControl(Me.PnlAjaxUpdate, True)
DotNetNuke.Framework.AJAX.RegisterPostBackControl(Me.btnPostBackTimeUpdate)
End If
End Sub
Protected Sub btnPostBackTimeUpdate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPostBackTimeUpdate.Click
Threading.Thread.Sleep("5000")
lblCurrentTime.Text = System.DateTime.Now.ToString()
End Sub
Protected Sub btnTimeUpdate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnTimeUpdate.Click
Threading.Thread.Sleep("5000")
lblCurrentTime.Text = System.DateTime.Now.ToString()
End Sub
End Class