Wednesday, March 14, 2007

Getting Error '0.cells' is null or not an object, when menu is inside of UpdatePanel


Keep menu outside of update panel and configure the trigger property as the following example code.


<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Menu1" EventName="MenuItemClick" />
</Triggers>
</asp:UpdatePanel>

<asp:Menu ID="Menu1" runat="server" BackColor="#F7F6F3" DynamicHorizontalOffset="2"
Font-Names="Verdana" Font-Size="Small" ForeColor="#7C6F57" OnMenuItemClick="Menu1_MenuItemClick"
StaticSubMenuIndent="10px" Width="150px">
<StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<DynamicHoverStyle BackColor="#7C6F57" ForeColor="White" />
<DynamicMenuStyle BackColor="#F7F6F3" />
<StaticSelectedStyle BackColor="#5D7B9D" />
<DynamicSelectedStyle BackColor="#5D7B9D" />
<DynamicMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" />
<Items>
<asp:MenuItem Text="Save" Value="Save"></asp:MenuItem>
<asp:MenuItem Text="New" Value="New"></asp:MenuItem>
</Items>

No comments: