i m developing application using ajax in asp.net 2.0 . I m using menu control of asp.net,multiview and view control.while running this application i got error "Microsoft JScript runtime error: '0.cells' is null or not an object" so now what is the solution of this i have returend following coad in html
<
div><
asp:UpdatePanelID="UpdatePanel2"UpdateMode="Conditional"runat="Server"><ContentTemplate><tablecellpadding="0"cellspacing="0"border="0"width="100%"><tr><tdwidth="6%"><asp:MenuID="Menu1"runat="server"DynamicHoverStyle-BackColor="Aqua"DynamicHoverStyle-Font-Overline="true"DynamicHoverStyle-ForeColor="Brown"DynamicMenuItemStyle-BackColor="Crimson"dOrientation="Horizontal"StaticEnableDefaultPopOutImage="False"OnMenuItemClick="menu_click"Orientation="Horizontal"><Items><asp:MenuItemText="Operator"Value="0"></asp:MenuItem><asp:MenuItemText="Visitor"Value="1"></asp:MenuItem></Items><StaticMenuStyleBackColor="White"/><StaticMenuItemStyleBackColor="White"/><StaticSelectedStyleBackColor="#FFC080"/><StaticHoverStyleBackColor="#80FFFF"/></asp:Menu><asp:MultiViewID="MultiView1"runat="server"><asp:ViewID="op"runat="server"><tablewidth="30%"><trvalign="top"><td>hetal</td></tr></table></asp:View><asp:ViewID="visitor"runat="server"><tablewidth="30%"><trvalign="top"><td>tarun</td></tr></table></asp:View></asp:MultiView></td>
</tr>
</table>
</ContentTemplate>
</
asp:UpdatePanel>
</
div>
please give me solution for this error...thank u
<asp:menu > control seems to be not compatible withUpdatepanel. Put the menu control outside the updatepanel. If you wantto refresh only updatepanel contents on click of menu control, then setmenu control as an async postback trigger for updae panel as givenbelow.
try following modified code.
<div>
<asp:Menu ID="Menu1"runat="server" DynamicHoverStyle-BackColor="Aqua"DynamicHoverStyle-Font-Overline="true"DynamicHoverStyle-ForeColor="Brown"DynamicMenuItemStyle-BackColor="Crimson" dOrientation="Horizontal"StaticEnableDefaultPopOutImage="False" OnMenuItemClick="menu_click"Orientation="Horizontal">
<Items>
<asp:MenuItem Text="Operator" Value="0" ></asp:MenuItem>
<asp:MenuItem Text="Visitor" Value="1"></asp:MenuItem>
</Items>
<StaticMenuStyle BackColor="White" />
<StaticMenuItemStyle BackColor="White" />
<StaticSelectedStyle BackColor="#FFC080" />
<StaticHoverStyle BackColor="#80FFFF" />
</asp:Menu>
<asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="Server">
<ContentTemplate>
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td width="6%">
<asp:MultiView ID="MultiView1" runat="server" >
<asp:View ID="op" runat="server">
<table width="30%">
<tr valign="top"><td>hetal</td></tr>
</table>
</asp:View>
<asp:View ID="visitor" runat="server">
<table width="30%">
<tr valign="top"><td>tarun</td></tr>
</table>
</asp:View>
</asp:MultiView>
</td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Menu1"EventName="MenuItemClick" />
</Triggers>
</asp:UpdatePanel>
</div>
You can also add the below script to your aspx page. It overrides the AJAX function and takes care of the error. This works for problems with Tab Controls too, seehttp://forums.asp.net/thread/1628780.aspx.
<scripttype="text/javascript">
var oldMenu_HideItems = Menu_HideItems;if(oldMenu_HideItems){
Menu_HideItems =
function(items){
if (!items || ((typeof(items.tagName) =="undefined") && (itemsinstanceof Event))){
items = __rootMenuItem;
}
if(items && items.rows && items.rows.length == 0)
{
items.insertRow(0);
}
return oldMenu_HideItems(items);
}
}
</script>
No comments:
Post a Comment