Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
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
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

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
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server