HTML代码:
<table>
<tr>
<td></td><td><input id="fileToUpload" type="file" size="45" name="fileToUpload"></td>
</tr>
<tr>
<td colspan=2>请选择文件上传(asp.net默认上传最大为4M,大于4M会出错)</td>
</tr>
tr>
<td>标题</td><td><input id="txtTilie" type="text" /></td>
</tr>
<td>内容</td><td><input id="Text2" type="text" /></td>
</tr>
<tr>
<td>
<button class="button" id="buttonUpload" >Upload</button></td>
</tr>
</table>要时间无刷新的将文件上传到服务器的文件夹上,并将上传文件的路径、标题及短信内容写入数据库相关的表中。
并且在上传及操作数据库的过程中,要有类似 “数据操作中,请不要关闭网页”的提示。。
不使用AJAX我已经实现。
现在跪求AJAX版本。。如果是基于微软的AJAX最好。。
其他的也行。如AJAXPRO或JQUERY都可以如果分不够,请说另开贴送分

解决方案 »

  1.   

    设置Button为PostBackTrigger
    JQuery上传插件Uploadify
    ajax 异步上传
    updatepanel 文件上传
      

  2.   

    http://www.javaeye.com/topic/81120ajax jsp 无刷新上传文件
      

  3.   

    VS的 FileUpLoad 控件不支持在Ajax中的UpdatePanel内使用,
    如要在Ajax使用VS的 FileUpLoad,则要把 FileUpLoad放在UpdatePanel之外,这样页面会有刷新的我的解决方法是用第三方控件如:
    Anthem.dll
      

  4.   

    to:wuyq11...
    设置Button为PostBackTrigger
    或者把ScriptManager的EnablePartialRender置为False
    之后,UpdateProgress就出不来了。。
    而且页面会刷新。。我现在最主要是想,UpdateProgress的提示能够出来。。
    担心数据大,上传或写入数据库慢的时候,用户重复点击按钮
      

  5.   

    我的解决方法是用第三方控件如:
    Anthem.dll
      

  6.   

    gdlpc....
    能不能说具体点。。
    例如给点代码。。
    急用
      

  7.   

    有一个新添异步上传的控件: Ajax Control Toolkit AsyncFileUpload 
    http://www.asp.net/ajaxlibrary/act_AsyncFileUpload.ashx
      

  8.   

    //在:Web.config
    <controls>
            <add tagPrefix="anthem" namespace="Anthem" assembly="Anthem" />
            <!--上句是用Ajax上传控件Anthem的引用-->
            <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
          </controls>
    //以下的是大概是这个样子,连接数据库的字符串改为你的等等。
    //这是我现在能正常使用的代码,由于代码太多,不全复制了,而且有的参数是自定义的,较难看明白
    //aspx中:
    <anthem:Label ID="Label2" runat="server" Font-Size="10pt" ForeColor="Blue" Text="上传信息"></anthem:Label>
    <anthem:Image ID="Image1" runat="server" Height="125px" ImageUrl="~/Images/nopic.gif"
                                                Width="94px" />
    <anthem:Button ID="anthemUploadButton" runat="server" EnabledDuringCallBack="false" OnClick="anthemUploadButton_Click"
                                                Text="上传" Width="70px" TextDuringCallBack="uploading..." />//.cs中:
    protected void anthemUploadButton_Click(object sender, EventArgs e)
        {
    string filename = anthemFileUpload.FileName;
                            string filenameid = System.DateTime.Now.ToString("yyyy-fff");
                            //string serverpath = Server.MapPath("~/Picture/" + mymulu + "/") + filenameid + filename;
                            string serverpath = Server.MapPath("~/Picture/" + mymulu + "/") + booksname;//以书名文件名保存
                            string tppath = "~/Picture/" + mymulu + "/" + booksname;//图片数据库保存路径
                            anthemFileUpload.SaveAs(serverpath);
                            string showpath = Server.MapPath("~/Picture/temp/") + filenameid + filename;//本页显示刷新图片保存路径
                            string tpshow = "~/Picture/temp/" + filenameid + filename;//本页显示刷新图片保存路径
                            anthemFileUpload.SaveAs(showpath);
                            Image1.ImageUrl = tpshow;//在本页显示相片要用anthem控件
                            Image1.UpdateAfterCallBack = true;
                            Label2.Text = "已上传到:" + tppath;// 已上传了封面图片数据库保存路径信息
                            Label2.UpdateAfterCallBack = true;
                            //图片路径更新到数据库的cover_picture字段
                            string sqlstr = "update booksdata set cover_picture=" + "'" + tppath + "'" + "where books_name=" + "'" + TextBox1.Text.ToString().Replace(" ", "") + "'";
                            sqlcon = new SqlConnection(strCon);
                            sqlcon.Open();
                            sqlcom = new SqlCommand(sqlstr, sqlcon);
                            sqlcom.ExecuteNonQuery();//更新图片保存路径
                            sqlcon.Close();}