When you try to implement a ASP.NET FileUpload control in AJAX, you will not be able to upload your file. This is because, FileUpload1.HasFile function will always return you a false value.
The reason why FileUpload1.HasFile always return you a false value is because, the FileUpload control is designed to be used only in PostBack scenarios and not in Asynchronous PostBack scenarios during partial rendering. When you use a FileUpload control inside an UpdatePanel control, the file must be uploaded by using a control that is a PostBackTrigger object for the panel. UpdatePanel controls are used to update selected regions of a page instead of updating the whole page with a postback.
[Assuming that you already have the your UpdatePanel, FileUpload, and Button Control in placed]
- Add “ enctype="multipart/form-data" ” to your form tag.
- Add a PostBackTrigger to the Triggers section in the UpdatePanel Control.
- Set the ControlID to the ID of your Button for the PostBackTrigger
Below are sample codes for your reference:
In this post, we’ll set up Windows Live Writer Wave 4 Beta (WLW).
Configuring Windows Live Writer Wave 4 Beta
1) Just to make sure that you have installed Windows Live Wave 4 Beta, your Windows Live Writer should be Version 2010.
2) Click on the “Add blog account” button under the Home tab of the ribbon. (If you have just installed WLW, WLW will automatically prompt you to add a blog account when you run the program.)
3) Now, you can choose which blog service do you use. WLW supports Windows Live Spaces, SharePoint blogs, Blogger, TypePad, WordPress, and others. Click Next after you have chosen your blog service.
4) Based on your option in the previous step, enter your blog address (if required), username, and password. Then, click Next.
If you have chosen “Windows Live Spaces”, your current screen should look like the one on the left below. If you have chosen “SharePoint blog”, your current screen should look like the one on the middle below. If you have chosen “Other blog service”, your current screen should look like the one on the right below.
5)After you have entered the required credentials, Windows Live Writer will set your blog account up.
6) Give your new blog a name and you’re done!
If you have multiple blog accounts, you can just repeat the steps above. You can easily switch to which blog do you want to update a new post by selecting from the drop down list above the “Add blog account” button.
I hope this post have been helpful. Please let me know if it was anything I can do to make this post better. Thanks!