AjaxUploadControl不火onuploadcomplete方法 [英] AjaxUploadControl does not fire onuploadcomplete method

查看:179
本文介绍了AjaxUploadControl不火onuploadcomplete方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想实现我的网站上AjaxUploadControl功能,但它不火的OnUploadComplete方法。相反,它只是说文件上传100%,但该文件没有在指​​定的文件夹。我在OnUploadComplete方法中设置断点,并已能确定,它永远不会触及这个方法。它几乎似乎跳进一个无限循环作为取消按钮显示,但没有在屏幕上的按钮中的是可点击一旦已经试图上载文件。

I am trying to implement the AjaxUploadControl functionality on my site but it does not fire the OnUploadComplete method. Instead, it simply says file uploaded 100%, but the file is not in the specified folders. I have set breakpoints in the OnUploadComplete method and have been able to determine that this method is never being reached. It almost seems to be jumping into an infinite loop as the Cancel button displays, but none of the buttons on the screen are clickable once an attempt has been made to upload a file.

在.aspx页面:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AjaxTest.aspx.cs" Inherits="AjaxTest" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        </ajaxToolkit:ToolkitScriptManager>
    <div>
            <ajaxToolkit:AjaxFileUpload ID="ajaxUpload1" runat="server" OnUploadComplete="ajaxUpload1_OnUploadComplete" />
    </div>
    </form>
</body>
</html>

在codebehind文件:

The codebehind file:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class AjaxTest : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void ajaxUpload1_OnUploadComplete(object sender,   AjaxControlToolkit.AjaxFileUploadEventArgs e)
    {
        string filePath = "~/SiteImages/" + e.FileName;
        ajaxUpload1.SaveAs(MapPath(filePath));
    }
}

帮助是极大的AP preciated!

Help is greatly appreciated!

推荐答案

我发现我有这个问题。我是想实现一个网站与一个web应用程序的功能。我创建了一个测试Web应用程序平台,它准确无误地运行。我是一个初学者AJAX并没有意识到,这会导致问题,但是,没有人知道一个解决方案,以获得此功能,在一个网站的工作。恐怕有太多轻松将转移到Web应用程序在这个时候。

I discovered the problem that I am having. I was trying to implement the functionality in a website versus a web app. I created a test web app platform and it worked flawlessly. I am a beginner to AJAX and did not realize that this would cause issues, however, does anyone know a solution to get this functionality to work in a website. I'm afraid that there is too much to easily port over to web app at this time.

这篇关于AjaxUploadControl不火onuploadcomplete方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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