By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,546 Members | 1,084 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,546 IT Pros & Developers. It's quick & easy.

Change from a Page to an I frame

P: 1
I have an iFrame declaired like that::
Expand|Select|Wrap|Line Numbers
  1. <iframe id="iFrame" runat="server"  class="tablecolumndiv" ></strong>
I put the two lines:
Expand|Select|Wrap|Line Numbers
  1. Protected WithEvents iFrame As System.Web.UI.HtmlControls.HtmlGenericControl<br/>
  2.     Public frame1 As HtmlControl = CType(Me.FindControl("iFrame"), HtmlControl)
In my code behind.
But when I come to the:
Expand|Select|Wrap|Line Numbers
  1. frame1.Attributes("src") = "/Pages/Support/Asp/Help01.aspx"
It throws me an error of :
Object reference not set to an instance of an object.
Because the
Expand|Select|Wrap|Line Numbers
  1. Me.FindControl("iFrame")
has a value of nothing
That error eliminates when I delete the `runat` from the element.
Jan 24 '14 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.