Topbar
Topbar
Sign in
|
Join
|
Client Center
Home
Products
Client Center
Contact
Purchase
Support forums
»
Products
»
Ajax Uploader
»
How to implement "remove button" function when I create a custom queue table?
How to implement "remove button" function when I create a custom queue table?
Last post 04-23-2009, 9:33 PM by
cutechat
. 3 replies.
Sort Posts:
Oldest to newest
Newest to oldest
Previous
Next
04-23-2009, 12:52 PM
51445
tmchuang
Joined on 04-24-2009
Posts 3
How to implement "remove button" function when I create a custom queue table?
Reply
Quote
Dear Sir:
When I create a custom queue table, I don't know how to implement a remove function in a custom queue table.
Could you give me some suggestion ?? Thank you a lot.
tmchuang
04-23-2009, 8:01 PM
51467
in reply to
51445
cutechat
Joined on 07-22-2004
Posts 2,332
Re: How to implement "remove button" function when I create a custom queue table?
Reply
Quote
tmchuang,
please use list[i].Cancel()
Regards,
Terry
04-23-2009, 8:45 PM
51469
in reply to
51467
tmchuang
Joined on 04-24-2009
Posts 3
Re: How to implement "remove button" function when I create a custom queue table?
Reply
Quote
Dear Terry,
It seem to use javascript to implement and it can't remove the file that I uploaded after I onclick the submit button.
if I create a custom quene table by build a datalist control, how could I do for it ? Thanks a lot.
Regards,
tmchuang
04-23-2009, 9:33 PM
51470
in reply to
51469
cutechat
Joined on 07-22-2004
Posts 2,332
Re: How to implement "remove button" function when I create a custom queue table?
Reply
Quote
tmchuang,
That should be the 'Attachments' 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