Topbar
Topbar
Sign in
|
Join
|
Client Center
Home
Products
Client Center
Contact
Purchase
Support forums
»
Products
»
Ajax Uploader
»
Re: Customization "Align all the Button in one line"
Re: Customization "Align all the Button in one line"
04-23-2009, 9:47 AM
cutechat
Joined on 07-22-2004
Posts 2,332
Re: Customization "Align all the Button in one line"
Reply
Quote
Prabhu
Here is a sample for you :
<
%@ Page
Language
=
"C#"
Title
=
"First sample"
%
>
<
%@ Import
Namespace
=
"CuteWebUI"
%
>
<
%@ Register
TagPrefix
=
"CuteWebUI"
Namespace
=
"CuteWebUI"
Assembly
=
"CuteWebUI.AjaxUploader"
%
>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"
>
<
script
runat
=
"server"
>
void InsertMsg(string msg)
{
ListBoxEvents.Items.Insert(0, msg);
ListBoxEvents.SelectedIndex
=
0
;
}
protected void UploadAttachments1_AttachmentAdded(object sender, AttachmentItemEventArgs args)
{
InsertMsg("Added.." + args.Item.FileName);
}
</
script
>
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
id
=
"Head1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
var
uploaderid
=
'<%=UploadAttachments1.ClientID %>'
;
function DoCancelAll()
{
var
uploader
=
document
.getElementById(uploaderid);
uploader.cancelall();
}
function DoSubmit()
{
var
uploader
=
document
.getElementById('
<
%=UploadAttachments1.ClientID %
>
');
var
submitbutton
=
document
.getElementById('
<
%=SubmitButton.ClientID %
>
');
if(!window.filesuploaded)
{
if(uploader.getqueuecount()
>
0)
{
uploader.startupload();
}
else
{
alert("Please browse files for upload");
}
return false;
}
window.filesuploaded
=
false
;
return true;
}
function CuteWebUI_AjaxUploader_OnPostback()
{
window.filesuploaded
=
true
;
var
submitbutton
=
document
.getElementById('
<
%=SubmitButton.ClientID %
>
');
submitbutton.click();
return false;
}
function CuteWebUI_AjaxUploader_OnQueueUI(list)
{
var
container
=
document
.getElementById("queuediv");
if(list.length
<
2
)
{
container.style.display
=
"none"
;
return false;
}
var
activerowindex
=-1;
container.style.display
=
""
;
container.innerHTML
=
""
;
var
table
=
document
.createElement("table");
table.style.borderCollapse
=
"collapse"
;
table.cellSpacing
=
0
;
table.cellPadding
=
4
;
table.border
=
1
;
table.borderColor
=
"darkgreen"
;
table.style.fontSize
=
"9pt"
;
for(var
i
=
0
;i
<
list.length
;i++)
{
var
name
=
list
.FileName
var
size
=
list
.FileSize // (or -1)
var
stat
=
list
.Status // Finish|Error|Upload|Queue
var
func
=
list
.Cancel;
var
row
=
table
.insertRow(-1);
row.insertCell(-1)
.innerHTML
=
name
;
var
last
=
row
.insertCell(-1);
if(
stat
=="Queue")
{
var
btn
=
document
.createElement("A");
btn.href
=
"BLOCKED SCRIPTvoid(0)"
;
btn.onclick
=
func
;
btn.innerHTML
=
"cancel"
;
last.appendChild(btn);
}
else
{
last.innerHTML
=
stat
;
if(
stat
=="Upload")
activerowindex
=i;
}
}
container.appendChild(table);
if(activerowindex
>
1)
{
container.scrollTop
=
Math
.floor(container.scrollHeight*(activerowindex-1)/list.length);
}
return false; //hide the default;
}
</
script
>
</
head
>
<
body
>
<
form
id
=
"Form1"
runat
=
"server"
>
<
div
>
<
table
>
<
tr
>
<
td
>
<
input
type
=
"button"
id
=
"BrowseButton"
onclick
=
"return false;"
value
=
"Broswe Files"
/>
</
td
>
<
td
>
<
input
type
=
"button"
onclick
=
"DoCancelAll();return false;"
value
=
"Cancel All"
/>
</
td
>
<
td
>
<
asp:Button
runat
=
"server"
ID
=
"SubmitButton"
OnClientClick
=
"return DoSubmit()"
Text
=
"Submit"
/>
</
td
>
</
tr
>
</
table
>
</
div
>
<
div
>
<
CuteWebUI:UploadAttachments
runat
=
"server"
ID
=
"UploadAttachments1"
OnAttachmentAdded
=
"UploadAttachments1_AttachmentAdded"
NumFilesShowCancelAll
=
"1000"
InsertButtonID
=
"BrowseButton"
ManualStartUpload
=
"true"
>
</
CuteWebUI:UploadAttachments
>
</
div
>
<
hr
/>
<
div
id
=
"queuediv"
style
=
"height: 100px; overflow-y: scroll; display: none"
>
</
div
>
<
br
/>
<
div
>
Server Trace:
<
br
/>
<
asp:ListBox
runat
=
"server"
ID
=
"ListBoxEvents"
Width
=
"800"
>
</
asp:ListBox
>
</
div
>
</
form
>
</
body
>
</
html
>
Regards,
Terry
View Complete Thread