Logo
Lose Weight
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
 
 
Windows Azure

The basics of BLOBs : Developing against containers (part 3) - Listing containers & Deleting a container

3/4/2011 8:51:02 AM

8.4.4. Listing containers

In the figure 1, there’s a grid that contains a list of all the containers in the account. To create that grid, you need to update your asp.net page to include an ASP.NET GridView component (you’re going to eventually bind this grid to a list of containers). You should place the code in the following listing before the code in listing 1 in the containers.aspx page.

Listing 3. Listing BLOBs with a GridView

The code in listing 3 is the ASP.NET markup for figure 8.11. Notice that you’re allowing the grid to autogenerate all the columns (except the Delete button and the View hyperlink) based on the properties of the object bound to the grid. Listing 8.4 shows the code-behind for your web page that gets a list of containers from the account and binds it to the grid.

Listing 4. Binding the grid

One interesting thing you’ll see in the Page_Load method is a call to SetConfigurationSettingPublisher. We wouldn’t normally put this code here, but it was the easiest place to put it in the book. When you load configuration in ASP.NET, it looks in the web.config file by default. If you’re storing your configuration in the .csdef file, ASP.NET will never find it. By including this line of code, you’re telling ASP.NET to look in the .cscfg file for the configuration you’re trying to load. We would normally put this in the Role_OnStart event, or somewhere else where it’ll be run once per role instance as it starts up.

Now you have a web page that will display all the containers in your storage account. The page also allows you to create new private containers. To complete your sample, you just need to implement the delete functionality.

5. Deleting a container

You want to be able to click the Delete button on a particular row in your web page to delete the underlying container. For this to happen, you need to hook in your Delete button. The following listing shows the code-behind for implementing the delete functionality.

Listing 5. Deleting the container

With the Delete button code hooked in, you should be able to run your application and view all the BLOB containers in development storage, add a container, and then delete it from your web page.

Wow, you’ve done a great job. You’ve just completed your first Windows Azure BLOB storage application. All that’s left is to make this baby work against the live BLOB storage service.

Other -----------------
- The basics of BLOBs : Developing against containers (part 1) - Accessing the StorageClient library & Accessing development storage
- The basics of BLOBs : Getting started with development storage
- A closer look at the BLOB storage service
- Storing files in a scaled-out fashion is a pain in the NAS (part 2) - The BLOB service approach to file management
- Storing files in a scaled-out fashion is a pain in the NAS (part 1) - Traditional approaches to BLOB management
 
 
Most view of day
- Windows Server 2012 Requirements and Installation : Customizing the Interface with Features on Demand
- Windows Phone 8 : Developing for the Phone - Application Lifecycle (part 3) - Tombstoning
- Microsoft Systems Management Server 2003 : Queries (part 1) - Query Elements
- System Center Configuration Manager 2007 : Network Design - Network Discovery
- Microsoft OneNote 2010 : Using the Research and Translate Tools (part 3) - Translating Text with the Mini Translator
- Microsoft Word 2010 : Creating Desktop Publishing Documents - Adding a Watermark
- Microsoft Visio 2010 : Linking External Data to Shapes (part 2) - Preparing the Light Bulb Shape for Data Linking
- Windows Phone 8 : Configuring Basic Device Settings - Controlling the Keyboard’s Behavior (part 3) - Customizing the Keyboard’s Behavior
- Microsoft Visio 2010 : Creating and Exporting SharePoint Workflow Diagrams
- Windows Phone 7 : The Silverlight Controls (part 8) - Layout Controls - StackPanel Controls, Canvas Controls
Top 10
- MDT's Client Wizard : Package Properties
- MDT's Client Wizard : Driver Properties
- MDT's Client Wizard : Application Properties
- MDT's Client Wizard : Operating System Properties
- MDT's Client Wizard : Customizing the Deployment Share
- Windows Server 2012 : Software and User Account Control Administration (part 5) - Maintaining application integrity - Configuring run levels
- Windows Server 2012 : Software and User Account Control Administration (part 4) - Maintaining application integrity - Application access tokens
- Windows Server 2012 : Software and User Account Control Administration (part 3) - Mastering User Account Control - Configuring UAC and Admin Approval Mode
- Windows Server 2012 : Software and User Account Control Administration (part 2) - Mastering User Account Control - Elevation, prompts, and the secure desktop
- Windows Server 2012 : Software and User Account Control Administration (part 1) - Software installation essentials
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro