Hello,
I have a question I hope someone has an answer for.
I have a custom control that includes the RadAsyncUpload control. In the onInit event handler calculate a MaxFileSize based on a config file setting and then register a couple of scripts to handle the error display if the file being uploaded exceeds the MaxFileSize:
i.e
StringBuilder sb = new StringBuilder();
sb.Append("\n\t<script type=\"text/javascript\">\n\t\tfunction UploadValidationError(sender, eventArgs)\n\t\t{\n\t\t\talert('")
.Append(AlertText1)
.Append(": ' + eventArgs.get_fileName() + ' ")
.Append(AlertText2).Append(" ")
.Append(MaxFileSize.ToString())
.Append(" kb.\');\n\t\t}\n\t</script>");
Page.Header.Controls.Add(new LiteralControl(sb.ToString()));
StringBuilder sb2 = new StringBuilder();
sb2.Append("\n\t<script type=\"text/javascript\">\n\t\tfunction FileUploadError(sender, eventArgs)\n\t\t{\n\t\t\talert('")
.Append(AlertText3)
.Append(" ' + eventArgs.get_message() );\n\t\t}\n\t</script>");
Page.Header.Controls.Add(new LiteralControl(sb2.ToString()));
Then when the RadAsyncUpload control is being added to the
public Telerik.Web.UI.RadAsyncUpload _uploadControl = new Telerik.Web.UI.RadAsyncUpload();
this._uploadControl.ID = "u" + this.QuestionID;
this._uploadControl.InitialFileInputsCount = 1;
this._uploadControl.MaxFileInputsCount = 1;
this._uploadControl.MaxFileSize = MaxFileSize;
this._uploadControl.FileUploaded += new FileUploadedEventHandler(File_FileUploaded);
this._uploadControl.TemporaryFolder = _fileVirtualPath;
this._uploadControl.TargetFolder =_fileVirtualPath ;
this._uploadControl.HttpHandlerUrl = "~/RadUpload/RadUploadFile.ashx";
this._uploadControl.Width = new Unit(250);
this._uploadControl.CssClass = "normalRemoveButton";
this._uploadControl.OnClientValidationFailed = "UploadValidationError";
this._uploadControl.OnClientFileUploadFailed = "FileUploadError";
this._uploadControl.Style.Add("display", "block");
this._uploadLabel.Text = NoFileSelectedText;
this._uploadLabel.Enabled = false;
this._uploadControl.Culture = new System.Globalization.CultureInfo(CultureCode);
This all works flawlessly on most browsers, select a file too large and the alert box pops up indicating that the filesize exceeds the limit. However on some testers machines, when they select a file to upload that is way too large , the yellow uploading line activates, the alert box does not show, and it continues in that state for several minutes if you let it.
(I am not even sure that it is browser related, it may be individual machines and the browser configutration). It does not seem to be version specific, we have tried this under IE7, IE8, and IE9.
Any ideas?
Thanks,
Gary
<
telerik:RadBinaryImage
ID
=
"RadBinaryImage1"
runat
=
"server"
DataValue='<%# Eval("Data") is DBNull ? null : Eval("Data")%> '
AlternateText=" " AutoAdjustImageControlSize="true"
ImageUrl='<%# Eval("Type", "~/Images/Devices/{0}_sml.png") %>'
Width="64px" Height="64px" ImageAlign="Middle" ResizeMode="Fit" />
<
telerik:RadBinaryImage
ID
=
"DeviceBinaryImage"
runat
=
"server"
DataValue='<%# Eval("Data") is DBNull ? null : Eval("Data")%> '
AlternateText=" " AutoAdjustImageControlSize="true"
Visible='<%# Eval("Data") is DBNull ? false : true %>'
Width="64px" Height="64px" ImageAlign="Middle" ResizeMode="Fit" />
<
asp:Image
ID
=
"Image1"
runat
=
"server"
ImageUrl='<%# Eval("Type", "~/Images/Devices/{0}_sml.png") %>'
Visible='<%# Eval("Data") is DBNull ? true : false %>' />
protected
void
LstBxSettings_Dropped(
object
sender, RadListBoxDroppedEventArgs e)
{
RadDockZone dockZone = DashboardLayoutManager.Instance.RegisteredDockZones.FirstOrDefault(registeredDockZone => e.HtmlElementID.Contains(registeredDockZone.ID));
if
(!
object
.Equals(dockZone,
null
) && !dockZone.Docks.Any())
{
RadPane activeControlPane = (RadPane)dockZone.Parent;
Orientation orientation = (Orientation)Enum.Parse(
typeof
(Orientation), e.SourceDragItems[0].Value);
CormantRadSplitter newContent = CreationManager.CreateNewContent(orientation, activeControlPane);
//Put newly created control in front so it will always be visible. (E.G. RadDockZone1 fights with it)
activeControlPane.Controls.AddAt(0, newContent);
RadControlManager.SaveNewContent(newContent);
lstBxSettings.ClearSelection();
}
}
protected
void
Page_Load(
object
sender, EventArgs e)
{
Logger.Info(
"Page Load"
);
RegenerationManager.Instance.RegenerateDockContents();
if
(!Page.IsPostBack)
{
RegenerationManager.Instance.RegenerateTabs(RadTabStrip1);
ScriptManager.RegisterStartupScript(Page, Page.GetType(),
"KEY01"
,
"ForceResize();"
,
true
);
}
}