This is a migrated thread and some comments may be shown as answers.

Asyncupload and Cannot create an object of type 'System.String'

1 Answer 58 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Fabio Cirillo
Top achievements
Rank 1
Fabio Cirillo asked on 14 Dec 2012, 08:44 AM
Hi
i've this code:
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" height="200px"
        width="112px">
        <telerik:RadAsyncUpload ID="RadAsyncUpload1" runat="server" Culture="it-IT"
        OnClientValidationFailed="OnClientValidationFailed" OnClientFileSelected="fileSelected" OnClientFileUploaded="fileUploaded"
        AllowedFileExtensions="jpeg,jpg,gif,png"
Localization-Remove="Rimuovi" Localization-Select="Cerca" MaxFileSize="5000000">
            <FileFilters>
                <telerik:FileFilter Description="Images(jpeg;jpg;gif;png)"
                Extensions="jpg,jpeg,gif,png" />
            </FileFilters>
            <Localization Cancel="Annulla trasferimento" Select="Cerca" Remove="Rimuovi" />
        </telerik:RadAsyncUpload>

but when i start the page there is this error: Cannot create an object of type 'System.String[]' from its string representation 'jpg,jpeg,gif,png' for the 'Extensions' property. Why?

Thanks





1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 19 Dec 2012, 08:44 AM
Hello Fabio,

 
We are aware of this issue(it is observed only in the 2012.3.1205 version of our controls) and it is already fixed (you could test our latest internal build). In case you don't  want to upgrade right now again  you can avoid the exception by removing the filters declaration from mark up and set it from the code behind. Here is an example how it should look like:

protected void Page_Load(object sender, EventArgs e)
   {
       var filter = new FileFilter();
       filter.Description = "my desc";
       filter.Extensions = new string[2];
       filter.Extensions[0] = "doc";
       filter.Extensions[1] = "jpg";
       RadAsyncUpload1.FileFilters.Add(filter);
   }

Hope this will explain the issue and be helpful. 

Regards,
Plamen
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
AsyncUpload
Asked by
Fabio Cirillo
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or