PDA

View Full Version : [CLOSED] Error pressing buttons hosted on a toolbar in overflow mode



sbg
Feb 26, 2014, 9:30 AM
Hello,
I get a strange error when the user clicks on a toolbar item located in the overflow menu. I recreate the issue this way:


<%@ Page Title="Test" Language="c#"
EnableSessionState="ReadOnly"
Culture="auto" meta:resourcekey="PageResource1" %>

<html>
<head></head>
<body>
<ext:ResourceManager runat="server" />
<ext:Window runat="server" Height="300" Width="300">
<TopBar>
<ext:Toolbar runat="server" ClassicButtonStyle="True"
Padding="5" EnableOverflow="True">
<Items>
<ext:Button runat="server" Text="LONG LONG LONG LONG LONG LONG LONG Command" OnDirectClick="OnToggle">
</ext:Button>
<ext:Button runat="server" Icon="PageWhite" EnableToggle="True" OnDirectClick="OnToggle">
</ext:Button>
</Items>
</ext:Toolbar>
</TopBar>
</ext:Window>
<script runat="server">
protected void OnToggle(object sender, Ext.Net.DirectEventArgs arg) {
}
</script>
</body>
</html>

if you go to overflow menu of the toolbar and whatever button I click, I get a message like:


The control with ID 'menuitem-1033' not found

Daniil
Feb 26, 2014, 10:00 AM
Hi @sbg,

Yes, there is a problem with such a scenario. The Toolbar overflow functionality creates a menu item for the Button if there is an overflow. A click event occurs for that menu item, not for the Button itself. And the DirectEvent cannot "understand" it.

We already have an Issue for similar problems.
https://github.com/extnet/Ext.NET/issues/21

Though, it is hard to fix all the cases in a generic way.

So, please use a Button's Handler + DirectMethod instead of DirectEvent.

<ext:Button runat="server" Handler="App.direct.ButtonClick();" />

sbg
Feb 27, 2014, 8:58 AM
Thank you, Daniil, it works.

Regards,
SBG



Hi @sbg,

So, please use a Button's Handler + DirectMethod instead of DirectEvent.

<ext:Button runat="server" Handler="App.direct.ButtonClick();" />

Daniil
Jan 29, 2015, 5:46 PM
A Button's Click Listener works now in Ext.NET 3.