Naeem Naeem - 2 months ago 12
HTML Question

I want when i click on <a href="whatever.aspx"></a> show the page inside the same page

That is my code:

<asp:DataList ID="dlGallery" runat="server" RepeatLayout="Flow" Width="100%" CellPadding="4" ForeColor="#333333">

<AlternatingItemStyle BackColor="White" ForeColor="#284775" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<ItemStyle BackColor="#F7F6F3" ForeColor="#333333" />

<ItemTemplate>
<table border="1">
<tr>
<td>
<a href="Album.aspx?GalleryId=<%#Eval("GalleryId") %>">
<%# Eval("GalleryName") %>
</a>
</td>
<td>
<%# Eval("GalleryDescription") %>
</td>
</tr>
</table>
</ItemTemplate>
<SelectedItemStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
</asp:DataList>


I want when i click on the a-tag the page dispaly in the iframe-tage .
I have an idea that use (onclick) with a-tag but i do not know how can i do it.
If there another way please tell me.

Answer

You can use the target attribute of the a-tag and give the name of the iframe as the target. This will load the page in the href to the iframe when you click on the link. eg.

<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<iframe  name="nn" src=""></iframe>
<a href="test.html" target="nn">link</a>
</body>
</html>