Click here to Skip to main content
11,930,231 members (40,837 online)
Rate this:
Please Sign up or sign in to vote.
See more: ASP.NET
I have a basic page with an image upload loaded through an iframe:
<asp:Panel runat="server">
      <asp:TextBox runat="server" id="imgCaption" CssClass="imgCaption" PlaceHolder="caption(optional)" />
      <asp:FileUpload runat="server" ID="programmImages" Width="200px" CssClass="offScreen" />
      <asp:Button runat="server" id="hiddenImageUpload" OnClick="UploadImage" CssClass="insButton" Text="Upload" />

the image upload depends on the route data in order to upload but whenever i try to upload the image i get this error:

> Object reference not set to an instance of an object

on this line:

var ProgName = Page.RouteData.Values["prog"].ToString()

this line works fine in other pages.

so how can i retrieve the route data through the iframe.

Posted 14-Nov-12 12:59pm
Edited 14-Nov-12 13:02pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

If you're in an iframe, it's a different page. The values in the hosting page don't come in to it. You have to pass those values to the iframed page, on the URL as a query string parameter
aidin Tajadod 14-Nov-12 21:19pm
Good catch. my 5.
bladde_89 15-Nov-12 13:46pm

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151126.1 | Last Updated 14 Nov 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100