← Back to all blogs

Posts tagged with 'c1expander'

Animating ComponentOne Expander

We animate the Framework elements by applying animation to their individual properties. For example, to make a framework element grow, we animate its Width and Height properties and to make it fade from view, we animate its Opacity property.

Epic AdventureWorks Part 3 - The Web App

This article is the third of a four part series: Epic AdventureWorks Part 1 - The Blueprints Epic AdventureWorks Part 2 - The Model Epic AdventureWorks Part 3 - The Web App Epic AdventureWorks Part 4 - The Style Check out the AdventureWorks ASP.NET Sample ASP.NET app online. Now that we designed the blueprints and built an object model, its time to start to develop a website. I am going to create an ASP.NET 3.5 website project. I want to take advantage of the model I built with the Entity Framework and use LINQ to easily query the model. These two technologies will help me rapidly develop against this otherwise daunting database. To build a website I usually start with the most critical piece first and work down the chain from there. So in my opinion the most important part of a retail company's website is the product catalog. Some people might argue that it is the shopping cart, but the way I see it, no one is going to buy until they know what the product is. So we will assume there is a direct sales team to take orders until our shopping cart is launched. General practices Before we dig into code, here are a few of general practices I use when doing ASP.NET web development. Follow MVC Patterns (even in WebForms) I have been following this pattern subconsciously for years of WebForms development. It just makes sense. So how do I follow the pattern in WebForms? In a nutshell: loosely. I like to seperate all of my UI "chunks" or "modules" into UserControls and create Classes for them to inherit. I usually make the Classes more general like "ProductModule" and many UserControls inherit from it to take advantage of common data models and params. I then organize my UserControls into folders that group them logically. For this project I create "Products" and "Order" to section the modules into product catalog UI and shopping cart UI. In the root UserControls folder I add common UI elements like Header and Footer. Take Advantage of ASP.NET UI Features I like to utilize App_Themes, Skins and MasterPages to make UI development faster and more efficient. App_Themes are a nice way to stay organized and adding Skins to them helps to apply theme and behavior settings across the entire app. MasterPages are probably my favorite feature added in ASP.NET 2.0 and have saved me countless hours of work. I am also a fan of using nested MasterPages to really build rich UI templates across a large web app, but we will just use on in this project. Import a CSS Layout Framework Once of the biggest frustrations in web design is layout. I consider myself a CSS guru and still get stumped on some complex layout issues. If you want to spend your time actually styling things with CSS and not trying to hack your layout to work in all browsers then this practice is for you. In this app (and all my work) I chose to use YUI stylesheets including reset, base and grids. Reset will basically reset style on every html element to create a clean pallete across all browsers. Base (which requires reset) will give consistent styling to all html elements. Grids (which requires reset and base) creates a layout framework for you to build pretty much any type of column layout you need. It gets a little crazy when writing the markup, so they also provide a grid builder to make things easier. I can't recommend this practice enough. It has saved me so much time and prevented so many headaches. Use 3rd Party Controls As much as I would love to think I can build every aspect of my projects alone, it just isn't reality. I know it sounds like hot air coming from me, but using 3rd party controls is a great way to shift focus from the tedious code to the fun stuff. I have already wasted too many precious keystrokes writing sort algorithms and browser hacks. I had to draw the line and let the pro's do it for me. One of the most productive things you can do as a developer is know when to delegate work. For me, that delegation includes using custom controls that usually have more functionality than I would ever care to write for myself. Seriously, who really wants to sit down and write a PDF writer? No offense if that kind of programming is your cup of tea, but it sure isn't mine. I want to build the app, get it out the door and watch people use it. Then I can spend my time refining the UX and not trying to fix bugs in the chart control I was to stubborn to purchase. That's right, you need to think of how much effort you are going to spend supporting the custom controls you build on your own, not just how long it would take to develop. The next time you go to develop some controls I would ponder how valuable your time is and whether it's worth your keystrokes. I'm sure you get the picture, so I will stop with the C1 fanboy stuff. Let's Dev! Build the Navigation The AdventureWorks database products are organized by Category and SubCategory. So the first thing to do is make a few methods to build these lists.  Let's start with one we need to make the main menu. For the menu we will need a list of the the base categories in the database. So here is what that method would look like using LINQ against my Entity Model. public static List GetMainCategories(){ var cats = from cat in Common.DataEntities.ProductCategory select cat; return cats.ToList();}