PDA

View Full Version : [CLOSED] CycleButton inside of FormPanel ActiveItem does not change



rmelancon
Mar 20, 2014, 2:02 PM
I have a CycleButton inside of a FormPanel and when you click the Button, inside the DirectChange event, the ActiveItem does not change accordingly. It works fine as long as it is not inside of a FormPanel.



<%@ Page Title="" Language="vb" AutoEventWireup="false" CodeBehind="CycleButton.aspx.vb" Inherits="Adhesion.Web.CycleButtonTest" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Ext.Net Example</title>

<script type="text/javascript">

</script>
</head>
<body>
<form id="Form1" runat="server">

<ext2:ResourceManager ID="ResourceManager" runat="server" />

<ext2:FormPanel ID="fpUserActionSettings" runat="server" Border="false" LabelWidth="150"
Cls="bold-form-labels" StyleSpec="padding-top:10px">
<Items>
<ext2:CycleButton ID="CycleButtonContext" runat="server" ShowText="true" Height="34" width="100" >
<Menu>
<ext2:Menu ID="MenuCycleButton" runat="server">
<Items>
<ext2:CheckMenuItem ID="miClient" runat="server" Text="Client" Icon="User" Checked="true">
<DirectEvents>
<Click OnEvent="ContextSelect">
<ExtraParams>
<ext2:Parameter Name="name" Value="Client" Mode="Value" />
</ExtraParams>
</Click>
</DirectEvents>
</ext2:CheckMenuItem>
<ext2:CheckMenuItem ID="miSecurity" runat="server" Text="Security" Icon="ChartLine">
<DirectEvents>
<Click OnEvent="ContextSelect">
<ExtraParams>
<ext2:Parameter Name="name" Value="Security" Mode="Value" />
</ExtraParams>
</Click>
</DirectEvents>
</ext2:CheckMenuItem>
</Items>
</ext2:Menu>
</Menu>
</ext2:CycleButton>
</Items>
</ext2:FormPanel>

</form>
</body>
</html>




Imports Ext.Net
Public Class CycleButtonTest

Inherits System.Web.UI.Page

Private Sub LoadActions(ByVal id As String)
' do some stuff
End Sub

<DirectMethod()>
Public Sub ContextSelect(sender As Object, e As DirectEventArgs)
LoadActions(sender.ID)
End Sub

Private Sub CycleButtonContext_DirectChange(sender As Object, e As DirectEventArgs) Handles CycleButtonContext.DirectChange
Ext.Net.X.Msg.Show(New Ext.Net.MessageBoxConfig With {
.Title = "Critical",
.Message = sender.ActiveItem.Text,
.Buttons = MessageBox.Button.OK,
.Icon = MessageBox.Icon.ERROR
})
End Sub
End Class

Daniil
Mar 20, 2014, 2:05 PM
Hi @rmelancon,

It works for me. Please clarify what Ext.NET version are you using?

rmelancon
Mar 20, 2014, 2:12 PM
Hi @rmelancon,

It works for me. Please clarify what Ext.NET version are you using?

This is in Version 2.5.0.24049

Daniil
Mar 20, 2014, 2:39 PM
Ok. It appears that it doesn't work if a Menu is not shown yet. I see the same behavior regardless a CycleButton is inside a FormPanel or not.

I would try to force rendering of Menu.

<ext:CycleButton>
<Listeners>
<AfterRender Handler="this.showMenu(); this.hideMenu();" />
</Listeners>
</ext:CycleButton>

rmelancon
Mar 20, 2014, 4:43 PM
That works. Thanks.