Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a gridview with an asyncfileupload control.
In general it works, but ONLY on the first row in the gridview

I get the
error: Unhandled Exception: The file attached is invalid.

but all rows are updated using Asyncfileupload except first rows............
pages enableEventValidation="false" validateRequest="false" viewStateEncryptionMode="Never" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"

All three Solution ,I try
My Problem is not Solving.....
Updated 12-Sep-12 1:28am


If you are using the Async file uploader control in AJAX Toolkit inside an update panel. when you select a file to upload, after selection, the file uploader control will be showing with Red background in the text field.

The fix for this problem is: click on the properties of the async file uploader control -> find ClientIDMode property -> change it from inherit to Auto ID.

Now try to build your web app. and select a file, The control will show the selected file with green background which means it is a valid input file validation being done by the control itself.
Share this answer
There is some conflicts in your page. enableEventValidation will be true by default for the page. This will validate the aspx page to the server. Try making that false in your page directive.
Try this:
<%@ Page Title="" Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Fire_PreQuote"
EnableEventValidation="false" %>

Share this answer
Just add the ClientIDMode="AutoID" option to AJax control & everything will work like a charm
Share this answer
I had the same problem. I had a template field with an async file upload control in the edit and footer templates. Whenever I tried to upload the file in the first row, it gave this error. I went into the async file control in the edit template and changed the ClientIDMode to 'Static'. The problem went away. I left the ClientIDMode as 'AutoID' in the footer.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900