如何使用jQuery ..发回ifram页面? [英] How to post back a ifram page using jquery..?

查看:135
本文介绍了如何使用jQuery ..发回ifram页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的主页是这样的..

My Main Page Like this..

<body>
    <form id="form1"  runat="server">
    <div style="width: 500px">
        <div style="float:left;">
            <iframe id="iFramImage" src="FileUploader.aspx" frameborder="0"></iframe>
        </div>
        <div style="float:right">
            <asp:Image ID="imgUploaded" runat="server" AlternateText="Image"  Height="400" Width="300"/>
            </div>
    </div>
    <div>
        <asp:Button ID="bntSaveImage" runat="server" Text="Save Image" 

            onclick="bntSaveImage_Click" />
    </div>
    </form>
</body>



FileUploader.aspx



FileUploader.aspx

<body>
    <form id="form1"  runat="server">
    <div>
        <asp:HiddenField ID="hdnImagFileName" runat="server" />
        <asp:FileUpload ID="ImageUpload" runat="server"/>        
    </div>
    </form>
</body>



FileUploader.aspx.cs



FileUploader.aspx.cs

public void FileUpload()
{
    if (ImageUpload.HasFile)
    {
        if (CheckFileExtension(ImageUpload.FileName))
        {
            string filePath = "~/temp_image/" + ImageUpload.FileName;
            ImageUpload.SaveAs(Server.MapPath(filePath));
        }
    }
    hdnImagFileName.Value = ImageUpload.FileName;
}
protected bool CheckFileExtension(string FileName)
{
    string ext = Path.GetExtension(FileName);
    switch (ext.ToLower())
    {
        case ".jpg":
        case ".png":
        case ".bmp":
        case ".gif":
            return true;
        default:
            return false;
    }
}



现在我想要的是使用时从我的
文件保存控制中选择一个图像文件 当时我在ifram的页面FileUploader.aspx中要调用FileUpload(),因此在该页面的哪个事件中我都将调用该函数,以便将我的文件上载到临时目录.



now what i want that when use select a image file from fileupload control held in my
ifram''s page FileUploader.aspx at that time i want to call FileUpload() so in which event of page i place that function call so my file will be uploaded at temp directory.

推荐答案

与JQuery无关.正如网上显示的众多示例所示,您将有一个按钮或其他控件来发起回发.从该事件中调用上载方法.
This has nothing to do with JQuery. As the multitude of examples available on the web show, you would have a button, or some other control to initiate the postback. Call the upload method from that event.


这篇关于如何使用jQuery ..发回ifram页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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