我在侧面导航栏上有两个链接。但它没有工作原因?
这是我的代码:
Admin.Master
DataSource
更新
<div class="w3-sidebar w3-bar-block w3-collapse w3-card-2 w3-animate-left" style="width: 200px; padding-top: 50px;" id="mySidebar">
<button type="button" class="w3-bar-item w3-button w3-large w3-hide-large" onclick="w3_close()">Close ×</button>
<a href="CreateUser.aspx" id="linkCreateUser" class="w3-bar-item w3-button">Create User</a>
<a href="AdminSecurity.aspx" id="linkSecurity" class="w3-bar-item w3-button">Security</a>
<%--<a href="#" class="w3-bar-item w3-button">Link 3</a>--%>
</div>
<div class="w3-main" style="margin-left: 200px; padding-top: 50px;">
<div class="w3-container">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
它出现在Chrome浏览器上面以上代码
Chrome浏览器
<asp:LinkButton ID="linkCreateUser" runat="server" PostBackUrl="https://www.google.co.in/?gws_rd=ssl" CssClass="w3-bar-item w3-button">Create User</asp:LinkButton>
<asp:HyperLink ID="HyperLink1" runat="server" Text="Create User hyper" NavigateUrl="CreateUser.aspx" CssClass="w3-bar-item w3-button" ></asp:HyperLink>
<a href="AdminSecurity.aspx" runat="server" id="linkSecurity" class="w3-bar-item w3-button">Security</a>
Jquery Click事件
<a id="HyperLink1" class="w3-bar-item w3-button" href="CreateUser.aspx">Create User hyper</a>
<a id="linkCreateUser" class="w3-bar-item w3-button active" href='javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$linkCreateUser", "", false, "", "https://www.google.co.in/?gws_rd=ssl", false, true))'>Create User</a>
<a href="AdminSecurity.aspx" id="linkSecurity" class="w3-bar-item w3-button">Security</a>
答案 0 :(得分:0)
尝试使用asp.net控件是否有效:
<asp:LinkButton ID="linkCreateUser" runat="server" PostBackUrl="CreateUser.aspx" CssClass="w3-bar-item w3-button">Create User</asp:LinkButton>
<asp:HyperLink ID="linkCreateUser" runat="server" Text="Create User" NavigateUrl="CreateUser.aspx" CssClass="w3-bar-item w3-button" ></asp:HyperLink>
如果仍然无法正常工作,请通过网页上显示的检查元素分享最终的锚标签html?
答案 1 :(得分:0)
如果您的网页位于项目的根目录中,则只需输入&#34; /&#34;在你的内部链接之前:
<a href="/CreateUser.aspx" id="linkCreateUser" class="w3-bar-item w3-button">Create User</a>
<a href="/AdminSecurity.aspx" id="linkSecurity" class="w3-bar-item w3-button">Security</a>