我无法复制这个问题,我的问题是如何在CuteWebUI Ajax Uploader网格中绑定数据,我使用CuteWebUI Ajax Uploader进行上传附件,我正在做什么我上传文档,将其存储到一个文件夹然后将它们的路径保存到数据库,现在我不知道如何绑定在页面刷新时在CuteWebUI Ajax Uploader网格中保存在数据库中的数据。
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="NocUpload.aspx.cs" Inherits="IMCU.Pages.NocUpload" %>
<%@ Register Assembly="CuteWebUI.AjaxUploader" Namespace="CuteWebUI" TagPrefix="cc1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<div>
<asp:UpdatePanel ID="AddAssetUpdatePanel" runat="server">
<ContentTemplate>
<cc1:UploadAttachments ID="Attachments1" runat="server" OnUploadCompleted="Attachments1_UploadCompleted"
ProgressPanelWidth="450" ShowCheckBoxes="false" RemoveButtonBehavior="Delete" ShowRemoveButtons="true" InsertText="Browse Document"
ProgressInfoStyle="padding-left:3px;font:normal 11px Tahoma;" OnAttachmentRemoveClicked="Attachments1_AttachmentRemoveClicked" OnPreRender="Attachments1_PreRender">
<CancelButtonStyle CssClass="Hidden" />
</cc1:UploadAttachments>
<br />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
CS
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
namespace IMCU.Pages
{
public partial class NocUpload : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Attachments1_UploadCompleted(object sender, CuteWebUI.UploaderEventArgs[] args)
{
string TempUploadFolder = Server.MapPath("~/TempUpload/" + Session["UserId"] + "/");
if (!Directory.Exists(TempUploadFolder))
Directory.CreateDirectory(TempUploadFolder);
foreach (CuteWebUI.UploaderEventArgs arg in args)
{
using (System.IO.Stream stream = arg.OpenStream())
{
arg.CopyTo(TempUploadFolder + arg.FileName.Replace(" ", "_"));
// arg.GetTempFilePath();
}
}
}
public string rename(string name)
{
return HttpUtility.UrlEncode(name).Replace("%", "_").Replace(" ", "_");
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
}
protected void btnCancel_Click(object sender, EventArgs e)
{
}
protected void Attachments1_AttachmentRemoveClicked(object sender, CuteWebUI.AttachmentItemEventArgs args)
{
//if the upload file has saved into the photos folder
if (File.Exists(Server.MapPath("~/TempUpload/" + Session["UserId"] + "/" + args.Item.FileName.Replace(" ", "_"))))
{
//delete it
File.Delete(Server.MapPath("~/TempUpload/" + Session["UserId"] + "/" + args.Item.FileName.Replace(" ", "_")));
}
}
protected void Attachments1_PreRender(object sender, EventArgs e)
{
// Attachments1.GetItemsTable();
}
}