G
Guest
I am getting the above error when attempt to set the src, height and width of
an iframe in C# code.
I am using this as an attempt to dynamically alter the image displayed in
the iframe tag of an aspx page. Can someome please explain why I am getting
the error and how it can be resolved - thanks.
The code and exception are below:
Code in aspx file:
<iframe runat="server" id="image1" name="image1" src="" height=""
width=""></iframe>
C# code:
HtmlControl image1 = (HtmlControl)this.FindControl("image1");
image1.Attributes["src"] = "~/images/Test.gif";
image1.Attributes["width"] = "100%";
image1.Attributes["height"] = "100%";
Exception:
[NullReferenceException: Object reference not set to an instance of an
object.]
Environmental.Page_Load(Object sender, EventArgs e) in
c:\Inetpub\wwwroot\AcornNETSite\Environmental.aspx.cs:42
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o,
Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
Thanks again
Andrew
an iframe in C# code.
I am using this as an attempt to dynamically alter the image displayed in
the iframe tag of an aspx page. Can someome please explain why I am getting
the error and how it can be resolved - thanks.
The code and exception are below:
Code in aspx file:
<iframe runat="server" id="image1" name="image1" src="" height=""
width=""></iframe>
C# code:
HtmlControl image1 = (HtmlControl)this.FindControl("image1");
image1.Attributes["src"] = "~/images/Test.gif";
image1.Attributes["width"] = "100%";
image1.Attributes["height"] = "100%";
Exception:
[NullReferenceException: Object reference not set to an instance of an
object.]
Environmental.Page_Load(Object sender, EventArgs e) in
c:\Inetpub\wwwroot\AcornNETSite\Environmental.aspx.cs:42
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o,
Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender,
EventArgs e) +34
System.Web.UI.Control.OnLoad(EventArgs e) +99
System.Web.UI.Control.LoadRecursive() +47
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061
Thanks again
Andrew