Apr 21, 2009, 3:14 PM
Panel collapse/exapand from Markup but not Codebehind?
For some reason, the purely Codebehind solution does not work. Panel1 will expand/collapse correctly every time, but Panel2 will not. It only collapse, but never expand. Can you tell me how to get the purely Codebehind solution to work? Thanks.
Codebehind:
Codebehind:
Partial Class PanelTest2
Inherits System.Web.UI.Page
Dim Panel2 As Coolite.Ext.Web.Panel
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim btn As New Coolite.Ext.Web.Button
With btn
.Text = "Collapse"
End With
Controls.Add(btn)
Panel2 = New Coolite.Ext.Web.Panel
With Panel2
.Title = "Test Panel"
.Collapsible = True
.Height = Unit.Pixel(500)
End With
Controls.Add(Panel2)
AddHandler btn.AjaxEvents.Click.Event, AddressOf Click_Event
End Sub
Protected Sub Click_Event(ByVal sender As Object, ByVal e As Coolite.Ext.Web.AjaxEventArgs)
If Not Panel2.Collapsed Then
Panel2.Collapse()
Else
Panel2.Expand()
End If
If Not Panel1.Collapsed Then
Panel1.Collapse()
Else
Panel1.Expand()
End If
End Sub
End Class
Markup:<%@ Page Language="VB" AutoEventWireup="false" CodeFile="PanelTest2.aspx.vb" Inherits="PanelTest2" %>
<%@ Register Assembly="Coolite.Ext.Web" Namespace="Coolite.Ext.Web" TagPrefix="ext" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<ext:ScriptManager ID="ScriptManager1" runat="server">
</ext:ScriptManager>
<br />
<ext:Panel ID="Panel1" runat="server" Height="300" Title="Title" Collapsible="true">
<Body>
</Body>
</ext:Panel>
&nbsp;
</form>
</body>
</html>