我在项目上有asp菜单项,在菜单项的子菜单上单击我想弹出一个div对话框。 我的aspmenuitem在这里
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
<Items>
<asp:MenuItem NavigateUrl="~/Cashbook/Parties.aspx" Text="Parties" />
<asp:MenuItem NavigateUrl="~/Cashbook/Accounts.aspx" Text="Accounts" />
<asp:MenuItem NavigateUrl="~/Cashbook/Funds.aspx" Text="Funds" />
<asp:MenuItem NavigateUrl="~/Cashbook/FundTransfer.aspx" Text="Fund Transfer" />
<asp:MenuItem NavigateUrl="~/Cashbook/Receipts.aspx" Text="Receipts" />
<asp:MenuItem NavigateUrl="~/Cashbook/Payments.aspx" Text="Payments" />
<asp:MenuItem NavigateUrl="~/Cashbook/AccountCategory.aspx" Text="Account Category" />
<asp:MenuItem Text="Reports">
<asp:MenuItem CssClass="sd" Text="Bank Reconcilation" />
<asp:MenuItem Text="Anexure" />
<asp:MenuItem Text="Statements" />
<asp:MenuItem Text="Categorywise Statements" />
</asp:MenuItem>
</Items>
</asp:Menu>
这里我使用了cssclass,但它给了我运行时错误:“MenuItem没有名为'CssClass'的公共属性”
请帮助我解决这个问题 提前谢谢
答案 0 :(得分:0)
更新您的菜单,如下所述:
<asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal">
<LevelSubMenuStyles>
<asp:submenustyle />
<asp:submenustyle CssClass="sd"/>
</LevelSubMenuStyles>
<Items>
<asp:MenuItem NavigateUrl="~/Cashbook/Parties.aspx" Text="Parties" />
<asp:MenuItem NavigateUrl="~/Cashbook/Accounts.aspx" Text="Accounts" />
<asp:MenuItem NavigateUrl="~/Cashbook/Funds.aspx" Text="Funds" />
<asp:MenuItem NavigateUrl="~/Cashbook/FundTransfer.aspx" Text="Fund Transfer" />
<asp:MenuItem NavigateUrl="~/Cashbook/Receipts.aspx" Text="Receipts" />
<asp:MenuItem NavigateUrl="~/Cashbook/Payments.aspx" Text="Payments" />
<asp:MenuItem NavigateUrl="~/Cashbook/AccountCategory.aspx" Text="Account Category" />
<asp:MenuItem Text="Reports">
<asp:MenuItem Text="Bank Reconcilation" />
<asp:MenuItem Text="Anexure" />
<asp:MenuItem Text="Statements" />
<asp:MenuItem Text="Categorywise Statements" />
</asp:MenuItem>
</Items>
</asp:Menu>
然后为对话框添加DIV
标记:
<div id="dialog" title="Contact form">
<p>Hi, I am dialog</p>
</div>
然后通过单击子菜单
添加脚本以初始化并显示对话框<script type="text/javascript">
// this initializes the dialog (and uses some common options that I do)
$("#dialog").dialog({ autoOpen: false, modal: true, show: "blind", hide: "blind" });
$('.sd').click(function () {
$("#dialog").dialog("open");
return false;
});
</script>