PDA

View Full Version : [CLOSED] CycleButton item count



cwolcott
Jan 20, 2015, 3:00 AM
How can I find the number of items in a cyclebutton in behind code?

Daniil
Jan 20, 2015, 5:43 AM
Hi Chris,

Does that make sense in your scenario?

Example

<%@ Page Language="C#" %>

<script runat="server">
protected void GetCount(object sender, DirectEventArgs e)
{
X.Msg.Alert("GetCount", this.CycleButton1.Menu[0].Items.Count).Show();
}
</script>

<!DOCTYPE html>

<html>
<head runat="server">
<title>Ext.NET v2 Example</title>
</head>
<body>
<form runat="server">
<ext:ResourceManager runat="server" />

<ext:CycleButton ID="CycleButton1" runat="server">
<Menu>
<ext:Menu runat="server">
<Items>
<ext:MenuItem runat="server" Text="Item 1" Icon="Accept" />
<ext:MenuItem runat="server" Text="Item 2" Icon="Add" />
</Items>
</ext:Menu>
</Menu>
</ext:CycleButton>

<ext:Button runat="server" Text="Count of CycleButton's items" OnDirectClick="GetCount" />
</form>
</body>
</html>

If it doesn't and you, for example, populate Items dynamically during DirectEvents or something, then Items.Count doesn't reflect a client side state. In this case you should go with an extra parameter for a request:

App.CycleButton1.menu.items.getCount()