PDA

View Full Version : Menupanel onselecteditemchanged event in version 0.8



egodoy
Apr 02, 2009, 12:09 PM
Hello,

Is it me or this event does not fire on the server side on version 0.8?
bellow I have provided a very simple code sample;



<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebCooliteTest._Default" %>


<%@ 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></title>
<link href="Styles/Stylesheet1.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">

<ext:ScriptManager ID="scriptManager1" runat="server" Theme="Gray" />
<ext:MenuPanel ID="MenuPanel1" runat="server" Height="300" Title="Menu"
Width="180" Cls="menuSelected" onselecteditemchanged="MenuPanel1_SelectedItemChanged" SelectedIndex="0">
<menu id="ctl35" >
<Items>
<ext:MenuItem runat="server" Text="Item1" ID="ctl36">
<menu>
<ext:Menu runat="server" ID="ctl37">
<Items>
<ext:MenuItem runat="server" Text="SubItem1" ID="ctl38" />
<ext:MenuItem runat="server" Text="SubItem2" ID="ctl39" />
</Items>
</ext:Menu>
</menu>
</ext:MenuItem>
<ext:MenuItem runat="server" Text="Item2" ID="ctl40" />
<ext:MenuItem runat="server" Text="Item3" ID="ctl41" />
<ext:MenuItem runat="server" Text="Item4" ID="ctl42" />
</Items>
</menu>
</ext:MenuPanel>



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



Server side event



protected void MenuPanel1_SelectedItemChanged(object sender, EventArgs e)
{
string test = string.Empty;
test = "test";
}




Thank you in advance,

Vladimir
Apr 02, 2009, 12:30 PM
Hi,

Please note that OnSelectedItemChanged is called when request to server performed (postback or ajax event). You need to initiate postback or ajax event to call it.


You can use ItemClick ajax event of Menu to call server side function when menu item was clicked