如何在超链接点击时导航到内容占位符中的页面

时间:2015-10-19 09:57:30

标签: asp.net master-pages site.master

母版页

<body style="height: 100%; width: 100%; padding: 0; margin: 0;" runat="server">

    <table>
        <tr>
            <td>
                <div id="wrapper">
                    <!-- Navigation -->
                    <nav class="navbar navbar-default navbar-fixed-top" style="margin-left: 0px">
                        <div class="container" style="height: 70px; width: 1300px; text-align: left">
                            <div class="navbar-header">
                                <a class="navbar-brand" href="#">
                                    <img src="Styles/Images/Orion_logo1.png" width="50" height="50" alt="Orion" />
                                </a><a class="navbar-brand" href="#">ORION</a>
                            </div>
                            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                                <ul class="nav nav-pills" style="float:none;display:table-cell;width:1%;text-align:center;height:70px;vertical-align:middle">
                                    <li class="active" style="text-align:center;margin: auto;vertical-align:middle"> 
                                        <%--<a href="testMasterChild.aspx" id="YourLink" runat="server" target="_Blank" data-toggle="tab" style="text-align:center;height:70px;width:110px;">Default View</a>--%>
                                        <asp:HyperLink runat="server" ID="lnkHome" data-toggle="tab" style="text-align:center;height:70px;width
                                            :110px;" NavigateUrl="~/testMasterChildPage2.aspx">Default View</asp:HyperLink>
                                    </li>
                                    <li><a href="testMasterChild.aspx" data-toggle="tab" style="text-align:center;height:70px;width:110px"  > One View</a> </li>
                                    <li><a href="testMasterChildPage2.aspx" runat="server"  target="_Blank" data-toggle="tab" style="text-align:center;height:70px;width:110px" >Admin View</a> </li>
                                </ul>
                            </div>
                        </div>
                    </nav>
                </div>
            </td>
        </tr>
    </table>
    <div style="margin-top:70px">
    <asp:contentplaceholder id="cphMain" runat="server" >

    </asp:contentplaceholder>
    </div>
</body>

儿童页面

<%@ Page Title="" Language="C#" MasterPageFile="~/mstOrion.Master" AutoEventWireup="true" CodeBehind="testMasterChildPage2.aspx.cs" Inherits="CLMWidgets.testMasterChildPage2" %>
<asp:Content ID="Content2" ContentPlaceHolderID="cphMain" runat="server">
    <h1> testing ChildPage 2!!</h1>
</asp:Content>

上面我添加了母版页和子页面代码。 我有一个母版页和一个子页面我必须在点击超链接后在内容占位符中打开子页面,请帮忙。

0 个答案:

没有答案