Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 单击菜单项上的调用jquery函数_C#_Jquery_Asp.net - Fatal编程技术网

C# 单击菜单项上的调用jquery函数

C# 单击菜单项上的调用jquery函数,c#,jquery,asp.net,C#,Jquery,Asp.net,我在我的项目上有一个菜单项,在菜单项的子菜单上单击我想弹出一个div对话框。 我的aspmenuitem在这里 <asp:Menu ID="NavigationMenu" runat="server" CssClass="menu" EnableViewState="false" IncludeStyleBlock="false" Orientation="Horizontal"> <Items> <asp:MenuItem NavigateUrl

我在我的项目上有一个菜单项,在菜单项的子菜单上单击我想弹出一个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’的公共属性”

请帮我解决这个问题
提前感谢

更新您的菜单,如下所述:

<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>
然后通过单击子菜单将脚本添加到初始化和显示对话框中

<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>

//这将初始化对话框(并使用我所做的一些常用选项)
$(“#dialog”).dialog({autoOpen:false,modal:true,show:“blind”,hide:“blind”});
$('.sd')。单击(函数(){
$(“对话框”)。对话框(“打开”);
返回false;
});

那么您的问题是CssClass还是Popup?谢谢回复。这对我帮助很大。现在对话框打开了,但另一个问题是,当我点击子菜单时,对话框会打开一段时间,一个页面会被刷新,所以它会消失。如何防止我的页面刷新?为子菜单项添加NavigateUrl=“#”。别忘了投票,并把它标为答案。这样它也可以帮助其他用户。
<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>