0

如何在选择 ASP.Net 母版页中的特定 jquery 选项卡后进行回发?
请帮忙。任何答案将不胜感激。谢谢

这是我的标记。顺便说一句,老实说,我只是从默认代码中复制了一些代码,因为我是 ASP.Net 的新手。我只是想尝试一些代码和设计,并想了解更多。

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="Site.master.cs"  Inherits="SiteMaster" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head runat="server">
<title></title>
<link href="~/Styles/Site.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script type="text/javascript" src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css" />

<script type="text/javascript">
    $(function () {
        $("#tabs").tabs();
    });
</script>

<asp:ContentPlaceHolder ID="HeadContent" runat="server">
</asp:ContentPlaceHolder>

</head>

<body>
<form runat="server">
<div class="page">
    <div class="header">
        <div class="title">
            <h1>
                My ASP.NET Application
            </h1>
        </div>
        <div class="loginDisplay">
            <asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
                <AnonymousTemplate>
                    [ <a href="~/Account/Login.aspx" id="HeadLoginStatus" runat="server">Log In</a>
                    ]
                </AnonymousTemplate>
                <LoggedInTemplate>
                    Welcome <span class="bold">
                        <asp:LoginName ID="HeadLoginName" runat="server" />
                    </span>! [
                    <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out"
                        LogoutPageUrl="~/" />
                    ]
                </LoggedInTemplate>
            </asp:LoginView>
        </div>
    </div>
    <div id="tabs" runat="server">
        <ul>
            <li><a href="Book.aspx" runat="server" id="Tab1">Book</a></li>
            <li><a href="Default.aspx" runat="server" id="Tab2">Authors</a></li>
            <li><a href="New.aspx" runat="server" id="Tab3">New</a></li>
            <li><a href="About.aspx" runat="server" id="Tab4">About</a></li>
        </ul>


 <div id="TabContent" class="main">
            <asp:ContentPlaceHolder ID="MainContent" runat="server" />
        </div>
    </div>
    <div class="clear">
    </div>
</div>
<div class="footer">
</div>
</form>
</body>
</html>

每当我单击任何选项卡时,它都不会回发,而是内容及其地址栏始终保留我设置为起始页的任何页面。

4

1 回答 1

0

试试这个代码

  $("#tab").on('click',function(){
    __doPostBack('tab','');
    });
于 2013-08-21T11:57:37.173 回答