Archive

Archive for July, 2010

Using FileUpload Control with UpdatePanel Control

July 10, 2010 1 comment

Problem:

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.

 

Solution:

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.

Step-By-Step Guide:

[Assuming that you already have the your UpdatePanel, FileUpload, and Button Control in placed]

  1. Add “ enctype="multipart/form-data" ” to your form tag.
  2. Add a PostBackTrigger to the Triggers section in the UpdatePanel Control.
  3. Set the ControlID to the ID of your Button for the PostBackTrigger

 

Below are sample codes for your reference:

FileUpload_ajax_aspx

 

C# Code:

FileUpload_ajax_aspx_cs

 

VB Code:

FileUpload_ajax_aspx_vb

Advertisements
Categories: ASP.NET Tags: , , ,

Setting up Windows Live Writer (Wave 4) Beta

July 4, 2010 Leave a comment

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.

WLW_wave4_beta_about

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.)

WLW_wave4_beta_addNewBlogAccount

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.

WLW_wave4_beta_selectBlogService

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.

WLW_wave4_beta_signinWinLiveIDWLW_wave4_beta_addNewBlogAccount_sharepointWLW_wave4_beta_addNewBlogAccount2

5)After you have entered the required credentials, Windows Live Writer will set your blog account up.

WLW_wave4_beta_setupBlogAcc

6) Give your new blog a name and you’re done!

WLW_wave4_beta_setBlogName

 

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.

 

Conclusion

I hope this post have been helpful. Please let me know if it was anything I can do to make this post better. Thanks!