Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
I have a basic asp.net 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" />
       </asp:Panel>
 
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.
 
Thanks
Posted 14-Nov-12 11:59am
Edited 14-Nov-12 12:02pm
v2

1 solution

Rate this: bad
good
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
  Permalink  
Comments
aidin Tajadod at 14-Nov-12 21:19pm
   
Good catch. my 5.
bladde_89 at 15-Nov-12 13:46pm
   
thanks

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

  Print Answers RSS
0 OriginalGriff 454
1 Maciej Los 404
2 CPallini 185
3 Sergey Alexandrovich Kryukov 182
4 Richard MacCutchan 120
0 OriginalGriff 5,634
1 Sergey Alexandrovich Kryukov 4,763
2 Peter Leow 2,954
3 Maciej Los 2,614
4 DamithSL 2,465


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