Note that there are some explanatory texts on larger screens.

plurals
  1. POFile Dialog Throws a Null Reference When Cancelled
    primarykey
    data
    text
    <p>In my site that has a file upload function, the File Dialog returns a null reference when I don't select a file and click Cancel. But here's the catch:</p> <p>When the user: </p> <ol> <li><p>Open file dialog > select file > click Open, but thought maybe he selected the wrong file, so he -- > open file dialog > click Cancel, the file uploads successfully. But...</p></li> <li><p>On that same page, there's a button that allows you to edit the entry you just created. So maybe the user uploaded the wrong file, so he -- open file dialog > select file > click Open, but again thought maybe he selected the wrong file so he -- openfile dialog > click Cancel. The fun ends here as I get an <code>Object reference not set to an instance of an object</code> error.</p></li> </ol> <p>What confuses me is that it goes through the same code but the first time it's run it works and on the second it fails? </p> <p>BTW, I'm using Michiel Post's <a href="http://www.michielpost.nl/Silverlight/MultiFileUploader/" rel="nofollow">MultiFileUpload</a> project.</p> <p>The scenarios I've given runs through this code:</p> <pre><code>else { MultiFileUpload.SelectUserFiles(); //This calls the MultiFileUpload if (MultiFileUpload.UserFiles.FileList.LastOrDefault().FileName != refFileName) { //do something } else { //this is triggered when the user clicks Cancel on the FileDialog return; } } </code></pre> <p>Again, the code works for scenario number 1, but fails for scenario number 2 which obviously is just the same as 1.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload