1

I am having the same problem as in this question.

I am using below code

<td>
  <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl="test.aspx">Add Hotel Detail</asp:HyperLink>
</td>
<td>
  <iframe id="frame1" style="height:800px; width:900px;" src="AdminControlPanel.aspx">
  </iframe>
</td>

But with <asp:HyperLink>,Target attribute is not showing the frame id

Community
  • 1
  • 1
Heena
  • 754
  • 5
  • 18
  • 30

2 Answers2

0

If you want to embed code into the page but separate it out then consider moving the content of the iframe into a UserControl.

This will let you create a reusable control that you can drop onto a page. You can use Public Properties to pass data into the UserControl and also set up custom Events so that the external page can subscribe and receive information when things happen inside it.

There is a small learning curve but it is very useful once you get your head around it.

rtpHarry
  • 13,019
  • 4
  • 43
  • 64
0

It is indeed possible to open the specified url in a named frame by setting the frame name in the target attribute. See: HTML target Attribute

<td>
    <asp:HyperLink ID="HyperLink1" runat="server" Target="frame1" NavigateUrl="http://...">
        Add Hotel Detail
    </asp:HyperLink>
</td>
<td>
    <iframe name="frame1" id="frame1" style="height:800px; width:900px;" src="AdminControlPanel.aspx">
    </iframe>
</td>
jdavies
  • 12,784
  • 3
  • 33
  • 33
  • what should be there in `src` of iframe? and in hyperlink->target I am not getting name for `frame1` only `_blank,_top,_search,_parent` – Heena Sep 23 '11 at 09:46
  • I guess Visual Studio or whichever development environment you are using does not offer that functionality. Either way it is valid HTML. With regards to the iframe src you should set it to whatever url you wish to be shown when the page is loaded. – jdavies Sep 23 '11 at 09:50
  • The trick is simple, not obvious. The 'name' attribute of the frame must be set, NOT the 'id' attribute. Then the 'target' attribute of the hyperlink must be the same as the frame 'name'. Then it will work. The example above has target="frame1" and name="Iframe1" so it won't work. Change one or the other so they are both the same. Also, for reasons unknown, Visual Web Developer intellisense does NOT show 'name' as a valid iframe attribute. – B H Apr 30 '13 at 07:23