Telerik,
My team and I have been trying to decipher this paradox for a couple of days now, but unfortunately, all our efforts have ended being futile. I have RadUpload and RadWindow on the same ASPX page. The screen or logic flow is as follows:
My team and I have been trying to decipher this paradox for a couple of days now, but unfortunately, all our efforts have ended being futile. I have RadUpload and RadWindow on the same ASPX page. The screen or logic flow is as follows:
- User selects multiple images, using RadUpload
- User clicks on preview button
- Onclick event is captured in code-behind file; uploaded images are saved in session; javascript is injected, using RadAjaxManager; and RadWindow is triggered, which ultimately shows all the uploaded images.
We are also disabling AJAX for RadAjaxPanel and RadAjaxManager in order for RadUpload to have a full post-back. One thing we have noticed that if we do not disable the AJAX for the preview button, everything works as expected. This behavior, however, forces the RadUpload.UploadedFiles property to show zero count - even though several files are uploaded to the control.
We were using 2010.2.713.35 version of Telerik.Web.UI assembly, and decided to update to 2010.2.929.35 build, which is latest build. The updates, however, did not solve the problem.
We will be anxiously waiting to hear back from you.
The default page is as follows:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
></
asp:ScriptManager
>
<
telerik:RadScriptBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function openEmergencyAlertDialog(caller) {
var queryStr = "PreviewEmergencyAlert.aspx";
var oWnd = radopen(queryStr, caller);
return false;
}
function conditionalPostback(sender, args) {
if (args.get_eventTarget() == "<%= PreviewButton.UniqueID %>") {
args.set_enableAjax(false);
var manager = $find('<%= RadAjaxManager1.ClientID %>');
manager.set_enableAJAX(false);
setTimeout(function() {
manager.set_enableAJAX(true);
}, 0);
}
}
</
script
>
</
telerik:RadScriptBlock
>
<
telerik:radajaxmanager
ID
=
"RadAjaxManager1"
runat
=
"server"
ClientEvents-OnRequestStart
=
"conditionalPostback"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"pnlStatus"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"pnlStatus"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:radajaxmanager
>
<
telerik:radajaxloadingpanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
Skin
=
"Vista"
Transparency
=
"80"
>
</
telerik:radajaxloadingpanel
>
<
asp:Panel
ID
=
"pnlStatus"
runat
=
"server"
>
<
div
style
=
"padding-left:45px;"
>
<
table
width
=
"900px"
>
<
tr
>
<
td
>
<
center
><
span
style
=
" color:#0066cc; font-weight:bold; font-size:18px;"
>Header </
span
>
<
span
style
=
"float:right; margin-top:-8px;margin-right:42px; "
>
<
asp:LinkButton
ID
=
"PreviewButton"
runat
=
"server"
onclick
=
"PreviewButton_Click"
Text
=
"Preview"
>
</
asp:LinkButton
>
</
span
>
</
center
>
</
td
>
</
tr
>
</
table
>
<!-- Start Download Image -->
<
div
style
=
"height:10px;"
></
div
>
<
div
style
=
"padding-left:4px;"
>
<
table
width
=
"850px"
border
=
"0"
style
=
"background:#75b458;"
>
<
tr
style
=
"line-height:20px;"
>
<
td
style
=
"width:152px;"
valign
=
"top"
>
<
asp:Label
ID
=
"Label3"
runat
=
"server"
Text
=
"Upload Image(s):"
></
asp:Label
>
</
td
>
<
td
>
<
span
style
=
"color:#fff;"
>Allowed extensions are: .gif, .jpg, .jpeg, .png, .bmp</
span
>
<
div
style
=
"height:4px;"
>
</
div
>
<
telerik:RadUpload
ID
=
"RadUpload1"
Runat
=
"server"
MaxFileInputsCount
=
"5"
ControlObjectsVisibility
=
"ClearButtons"
MaxFileSize
=
"250000"
AllowedFileExtensions
=
".gif,.jpg,.jpeg,.png,.bmp"
>
</
telerik:RadUpload
>
</
td
>
</
tr
>
</
table
>
</
div
>
</
div
>
</
asp:Panel
>
</
div
>
<
telerik:RadWindowManager
ID
=
"radEAWindowManager"
runat
=
"server"
>
<
Windows
>
<
telerik:RadWindow
ID
=
"radEmergencyAlert"
Width
=
"700px"
Height
=
"400px"
AutoSize
=
"false"
ShowContentDuringLoad
=
"true"
ReloadOnShow
=
"true"
VisibleStatusbar
=
"false"
runat
=
"server"
Behaviors
=
"Maximize,Close,Move,Resize,Reload"
NavigateUrl
=
""
KeepInScreenBounds
=
"true"
Modal
=
"True"
Title
=
"Select Entity Actions"
>
</
telerik:RadWindow
>
</
Windows
>
</
telerik:RadWindowManager
>
</
form
>
</
body
>
</
html
>
The code-behind
protected
void
PreviewButton_Click (
object
sender, EventArgs e )
{
if
( RadUpload1.UploadedFiles.Count > 0 )
{
List<
byte
[]> listImage =
new
List<
byte
[ ]> ( );
foreach
( UploadedFile validFile
in
RadUpload1.UploadedFiles )
{
Stream imageStream = validFile.InputStream;
int
imageLength = validFile.ContentLength;
byte
[] imageBinaryData =
new
byte
[ imageLength ];
int
n = imageStream.Read ( imageBinaryData, 0, imageLength );
listImage.Add ( imageBinaryData );
}
}
RadAjaxManager1.ResponseScripts.Add (
"openEmergencyAlertDialog('radEmergencyAlert');"
);
}
Thanks,