Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我这里有这个链接按钮
<asp:LinkButton ID="lnkButton" CssClass="Button" runat="server">Link Text</asp:LinkButton>
我在后面的代码中为它分配了一个 PostBackURL,就像这样
lnkButton.PostBackUrl = "#video";
但它不会去锚 div 视频,而是我得到一个页面未找到错误
我究竟做错了什么?
如果您只想导航到同一页面上的另一个 div,那么我认为您可以简单地使用div 的href属性Id。
href
Id
<asp:LinkButton ID="dd" runat="server" href="#video" Text="Go to Video" ClientIDMode="Static" ></asp:LinkButton>
当您希望页面在回发的其他地方导航时,应该使用 PostBackUrl。您想要页面内导航,因此您应该使用 NavigateUrl 属性。