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

Validate at less 1 file uploaded

2 Answers 87 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Felipe de Jesús
Top achievements
Rank 1
Felipe de Jesús asked on 24 May 2011, 05:08 AM
I trying to implement radasyncupload control inside radgrid.

I declare the upload control like:

<telerik:GridTemplateColumn DataField="usrSignature" EditFormColumnIndex="0"
HeaderText=
"<%$ Resources:Localization, usrSign%>"UniqueName="usrSignature">
    <ItemTemplate>
        <telerik:RadBinaryImage runat="server" ID="rb"
        DataValue='<%#Eval("usrSignature") is DBNull ? null : Eval("usrSignature")%>'
        AutoAdjustImageControlSize="false" Height="30px" Width="100px"
        AlternateText="<%$ Resources:Localization, NoSignature %>" />
    </ItemTemplate>
    <EditItemTemplate>
        <telerik:RadAsyncUpload ID="raupSignature" runat="server"
        AllowedFileExtensions="bmp,gif,jpg,jpeg,png" MaxFileInputsCount="1" />
    </EditItemTemplate>
</telerik:GridTemplateColumn>

I trying to validate that when UploadedFiles.Count == 0 i send a DBNull to database, and if UpladedFiles.Count > 0 i send the image uplaoded.

if (usrSignature.UploadedFiles.Count > 0)
    scmQuery.Parameters["@usrSignature"].Value = DBNull.Value;
else
    {
    UploadedFile file = usrSignature.UploadedFiles[0];
    byte[] fileData = new byte[file.InputStream.Length];
    file.InputStream.Read(fileData, 0, (int)file.InputStream.Length);
    scmQuery.Parameters["@usrSignature"].Value = fileData;
    }

This it's fine, but if i upload a file, then i delete the uploaded file, when i proceed to submit the record, I detect that UploadedFiles.Count = 1

I need to know how can decrease the UploadedFiles.Count every time when i delete a uploaded file.

I found a similar problem in the post: RadAsyncUpload does not clear uploaded files.

I'm using the version Q1 2010, and i need to find a solution for this problem.

NOTE: I found a similar problem in your Upload / Using RadAsyncUpload in an Ajaxified Grid example. If you add a image, then you delete the image, and then you proceed to add the record, One row in the grid it's deleted. If you repeat the operation to upload and delete more files, then produce a error.

I appreciated your time and your answer.

Regards,
Felipe Meléndez.

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar Terziev
Telerik team
answered on 27 May 2011, 03:04 PM
Hello Felipe,

The experienced behavior is due to a bug, which has already been fixed.

Unfortunately we couldn't provide a workaround for this problem.

Regards,
Dimitar Terziev
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
Felipe de Jesús
Top achievements
Rank 1
answered on 27 May 2011, 09:29 PM
Thanks for your answer.

Regards. Felipe
Tags
AsyncUpload
Asked by
Felipe de Jesús
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Felipe de Jesús
Top achievements
Rank 1
Share this question
or