开发者

how can i make a div target of a asp.net hyperlink control

开发者 https://www.devze.com 2023-02-06 14:49 出处:网络
have a page with many links. when any link is clicked, the page corresponding to that hyperlink should open within a specified area on the same page, that is the \"div content\"

have a page with many links.

  • when any link is clicked, the page corresponding to that hyperlink should open within a specified area on the same page, that is the "div content"

  • yes i can use iframe

  • but can i make a div targe开发者_如何转开发t of the hyperlink?

please no jscript only html and asp.net


You can use anchors and use it to target your iframe

<a href="http://www.google.com" target="thisframe">Google</a>
<iframe name="thisframe" src="http://www.yahoo.com"></iframe>

As far as i know, you can never target *div*s unless you use javascript to manipulate the DOM, though. But if you really REALLY had to use the HyperLink control instead, the you can use the following code instead of using the anchor:

<asp:HyperLink ID="uxHyperLink" runat="server" Target="thisframe" NavigateUrl="http://www.google.com">Google</asp:HyperLink>
<iframe name="thisframe" />


you can use html bookmarks. For an example click on this link http://www.matlus.com/quartz-for-aspnet/#videos

If will not only take you to a page but scroll your browser down to the "videos" section onthe page.

In the url (the link) notice the /#videos. That is the bookmark. On the target page in question I have an anchor tag with it's name attribute set to "videos"

[a name="videos"][/a]

I'm using square brackets above because of the editor not allowing anchor tags. So basically, just above your "target" div, place an anchor tag and set the "name" attribute. Then you your link simply append the /#anchorname at the end of the url.

0

精彩评论

暂无评论...
验证码 换一张
取 消