Link to home
Start Free TrialLog in
Avatar of psmithphil
psmithphilFlag for United States of America

asked on

Bug in MS AJAX UpdateProgress component

I'm using asp.net & vb.net in Visual Studio 2005 & IE6.  I have a web application that uses the FileUpload component to choose a file on the hard disk, process the file, and then return a message in the Label to indicate that the process is done.  When I made it an AJAX project, this working program failed with the error message "Object reference not set to an instance of an object" (only the label is in the UpdatePanel).  I have attached a Word document, which I think should outline the problem, but please let me know if there is more I need to provide.  

Thank you for your help.
Experts-Exchange-Bug-in-MS-AJAX-.doc
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Do you have the complete stack trace for that exception, and not just the error message?  Do you know what line it happens on?

Bob
Avatar of psmithphil

ASKER

Thank you for helping, Bob!  Did you notice I included a Word document that explains the problem and has pictures?  I was hoping it would outline the process better than I could explain it with just words.

The error occurs on the first line in the btnProcess Sub:
strDownloadDumpFile = FileUpload1.PostedFile.FileName   'Full file and path.

The StackTrace doesn't supply much:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Main.btnProcess_Click(Object sender, EventArgs e) in C:\MyDocuments\Visual Studio 2005\WaterMarkDocs\Main.aspx.vb:line 60"
?ex.StackTrace
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Yes, the document doesn't have the StackTrace.  The StackTrace is:
System.NullReferenceException: Object reference not set to an instance of an object.
   at Main.btnProcess_Click(Object sender, EventArgs e) in C:\MyDocuments\Visual Studio 2005\WaterMarkDocs\Main.aspx.vb:line 60"
?ex.StackTrace

So with a FileUpload control, I can't do what I want?  
Nope, Monday blues!!  The FileUpload should work, it is being messed up by the UpdatePanel.

Bob
The problem is that the FileUpload control needs a full post-back in order to work properly.  

Try setting the ScriptManager like this (turning off partial rendering):
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="false" />

Bob
Using "EnablePartialRendering" gets rid of the error message, but it works like it does if I use "PostBackTrigger" instead of "AsyncPostBackTrigger".  It processes the file, but the AJAX animation doesn't work.

If I'm seeing this correctly, there is no way to do what I want.  I thought AJAX would be cool, but I guess some of it doesn't work in the real world. It would seem it would be easy to allow a user to get a dialog box to pick a file, then my program could process the file as necessary.  Along with it would be an animation indicating the processing is happening.  But I guess it can't be done with AJAX.

It seems like you've answered my question, that it can't be done, so I will award you the points.  I very much appreciate your help!

Would it do me any good to ask a new question to see if there is another control that will present the user with a dialog box to choose the file, and have the AJAX animation work while the file processes?
Have you heard of Telerik R.A.D. controls?

http://www.telerik.com/products/aspnet/overview.aspx

They have some really cool controls, which use AJAX internally, and also work with other versions of AJAX.  There is a pretty extensive list of controls, including the RadUpload control.

Bob
Thank you for the tips on telerik, Bob.  I'll see if they'll help.  But it sure seems like this is a simple thing I want to do, and that Microsoft's stuff should handle it.
Well, Bob, the answer is that what I want to do can't be done with AJAX.   Major bummer.   I appreciate your help very much!