asp.net如何从iframe访问路线数据 [英] asp.net how to access route data from an iframe

查看:85
本文介绍了asp.net如何从iframe访问路线数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个基本的asp.net页面,其中通过iframe加载了图片上传:

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()

;

此行在其他页面上正常工作.

所以我该如何通过iframe检索路线数据.

谢谢

;

this line works fine in other pages.

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

Thanks

推荐答案

如果您位于iframe中,则页面是不同的.托管页面中的值不包含在其中.您必须将这些值作为查询字符串参数传递到URL上的iframed页面
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


这篇关于asp.net如何从iframe访问路线数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆