Hi,
You can draw another table :
-
<%@ Page Language="C#" %>
-
<%@ Register TagPrefix="CuteWebUI" Namespace="CuteWebUI" Assembly="CuteWebUI.AjaxUploader" %>
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-
-
<script runat="server">
-
-
protected override void OnPreRender(EventArgs e)
-
{
-
base.OnPreRender(e);
-
-
//hide the default table
-
UploadAttachments1.GetItemsTable().Visible = false;
-
//bind the grid every times
-
DataGrid1.DataSource = UploadAttachments1.Items;
-
DataGrid1.DataBind();
-
DataGrid1.Visible = UploadAttachments1.Items.Count > 0;
-
}
-
-
protected void DataGrid1_ItemCommand(object sender, System.Web.UI.WebControls.DataGridCommandEventArgs e)
-
{
-
Guid guid = (Guid)DataGrid1.DataKeys[e.Item.ItemIndex];
-
foreach (AttachmentItem item in UploadAttachments1.Items)
-
{
-
if (item.FileGuid == guid)
-
{
-
if (e.CommandName == "Download")
-
{
-
using (Stream str = item.OpenStream())
-
{
-
Response.AddHeader("Content-Disposition", "attachment; filename=\"" + item.FileName + "\"");
-
Response.AddHeader("Content-Length", item.FileSize.ToString());
-
byte[] buff = new byte[4096];
-
while (true)
-
{
-
int rc = str.Read(buff, 0, buff.Length);
-
if (rc == 0)
-
break;
-
Response.OutputStream.Write(buff, 0, rc);
-
}
-
}
-
}
-
-
if (e.CommandName == "Remove")
-
{
-
item.Remove();
-
}
-
-
break;
-
}
-
}
-
}
-
-
</script>
-
-
<html xmlns="http://www.w3.org/1999/xhtml">
-
<head runat="server">
-
<title>DataGridCS</title>
-
</head>
-
<body>
-
<form id="form1" runat="server">
-
<div>
-
-
<CuteWebUI:UploadAttachments runat="server" ID="UploadAttachments1" UploadType=Flash>
-
</CuteWebUI:UploadAttachments>
-
<hr />
-
<asp:DataGrid ID="DataGrid1" runat="server" AutoGenerateColumns="false" DataKeyField="FileGuid" OnItemCommand="DataGrid1_ItemCommand">
-
<Columns>
-
<asp:BoundColumn DataField="FileGuid" HeaderText="File Guid" />
-
<asp:BoundColumn DataField="FileName" HeaderText="File Name" />
-
<asp:BoundColumn DataField="FileSize" HeaderText="File Size" />
-
<asp:ButtonColumn CommandName="Remove" Text="Remove" />
-
<asp:ButtonColumn CommandName="Download" Text="Download" />
-
</Columns>
-
</asp:DataGrid>
-
</div>
-
</form>
-
-
</body>
-
</html>
Regards,
Terry