Tuesday, May 27, 2008

Video: How Do I: Customize my Site with Profiles and Themes?

Presenter:Scott Stanfield

Learn how to use Profiles to collect per-user configuration information and apply Themes to extend a consistent look-and-feel throughout the Web site.

Click here to go to original video page

The following text is a software generated transcript of the video. Click on a minute link to jump to a location within the video

Minute 0

Welcome to this ASP net video tour of profiles and themes profiles and themes are great ways for you to customize the user spirits for your site you can use a custom profile to life store per user configuration information and you can use themes to allow you to give a different look and feel for your site we control the cascading style sheets and all the other images are part of your website s arrest our first by grading a website that looks at a Powell used the profile object so for some going to crater website by just opening up an empty folder under websites profiles and this would give me an empty website and to this I m going to start by creating a web config file and the reason one starting with the Web configuration file is that it s here where we define the schema or that the information that defines where profiles look like a number to the profiles is a little bit of bundled information like the users
Minute 1

Named her favorite color or some kind of preferences for the site it s where you ve here you define with the profile looks like it s stored in the database shall demonstrate a minute so we cut loose or become an empty configuration or web config file here we have on a given scene in Telesis before the web config this is a new feature in and visual Web developer 2005 need to add a section in here called profile and I m going to add a new property called for my and it s here that a user will be able to enter with a four man as by default will set the default light for anonymous and another thing we can do this is really cool is it we can even allow non authenticated users use this profile now later will there s another video were talked about membership and authentication roles that will go into more detail but in this case of maternal and allow non
Minute 2

Is so even users that have authenticated can still take imagined properties that turns out when you have anonymous profiles you have to go on a higher level here in able on a anonymous identification acknowledges that the equal to true they can see that a lot of other settings here having to do with Palm if weathers kookier cookie lists and where it stores the cookies name if it requires SSL for now we abides with having these two entries stored on the web config file for now we need a page to display our profile object so great a default page and this would be a really simple page all we really need here is a season taxed as now welcome and a label control right here at the hand of a label called little one until the run on the server like usual
Minute 3

And that s good now we need a page to set your profile looks to that record before forget credit page called settings and in order to get to the settings page when you hyperlink so put that in back on the main page of a good before we go fill out VS settings page let s see what this looks like a calm will want to do is when the page loads set the label equal to the profile not inevitably will the code appear at the top of my needed page load method and if are not in a post back situation is not page is the fact that we want to set the label one text value equal to novices will go watch profile full name so just by making the entry the web config week in a type safe Palm mock attacks against
Minute 4

So that this global optical profile is specific to this user and we run this I expect that to be equal to or default value for profile which was anonymous great social needed now was considered the settings page will change their profile and information now what we need to do is go to settings and putting something here enter your full name sauce which the design of this little bit easier when you text box and a button of the tribe is on the page and the save button and you set the text for that right now when user clicks save will imitate the information that s in the text box and stick it back in the profile
Minute 5

And also when the page loads when initialize the text box using the premises and code from the other page are able to test this out but will more think when the click save not only will I save the profile also this back to Main page which is so good anonymous but now ago put my name and say that never got so even if I close a site and come back later that will still be there and that s because it s storing up my my my computer information in my profile information inside a database that created force dynamically called a speed that
Minute 6

Debates now you ll see this database another s situations when we start dealing with membership rolls on a show to you right now inside tables if we look at users even though I don t have a real authentication is still tracking me as an anonymous user so there s my information in a cryptic and that s the name of my virtual machine and if they go to see profile against your profile information and can see that there s the definition schema full language to strain and its bytes zero for 15 acres of property value is pretty cool slopes close all this down now let s switchgear Schmidt now talk about themes and at the very and I ll show you how we can tie these two concepts together a theme is a collection of style sheets and imagery or these things called skin files that
Minute 7

You to customize the look and feel of your site to add a theme to your project and go back and add under the special is to that folder link this thing called themes now make one called Summer animosity that one cold winter make it right now okay for the summer theme were void add exhibit choices for style sheets and axonal files on at first a single skin file now skin file is a way for you to customize the look and feel of the server controls it s analogous to the cascading style sheet which is for HTML markup in this case any in the pastry net server control like the one of the default page this label control what is the template here for that sort is to label on that server for any UI modifications I make here will reflect on all latest in mobile controls so for this one for summer on all the fuss of the back color make up a couple
Minute 8

Chair Tom set the font size 2 large and the naming of the some thinks he can tell the difference in pay on a contending in a couple dashes and here oh now in order to use this though I need to go back to the web config and set the pages seem equal to summer and I think that s it who bring up there ago right so to change that and if we do something similar for winter I ll add a skin file their and for this and a lot of stylesheet okay so for the winter skin I ll just copy the details from the Summer one and just paste in and change a couple colors who make the background
Minute 9

Naked yellow in the fourth green I m a very simple palette of colors fair and just just to show that it s different make it extra small and now the other item added here was a stylesheet so you can see with the visual Web developer 2005 with a very nice stylesheet editor were going to set the background color for whole site consuming a full IntelliSense support I can also do this through a wizard if I do add style rule or build style and a dismissal dialog box with all kinds of features sauce at the background color here to do some light blue color is a simple by having and going back to the web config change in the winter should build pick up his new changes the background blue in a different form great the final thing we want to do is allow the user to choose the theme in the settings
Minute 10

Store a new theme information right here so for that we need to go here to the web config add one more property called my famous default equal to all the fault to winter and allow anonymous true as well and then in the page for settings once they were to need any that save buttons of her down here and will choose a theme and will put in a drop down combo comes to hard code to items in here last summer and winter a go back to the source code for this skin be similar when they click the save button to save the profile of the load at first when the page loads in the drop down list we want to
Minute 11

Find the item that corresponds to the to the profile information so that looks like find a drop down list items defined by value whatever s coming from the profile under my themes and in selected likewise when a save said the fee equal to drop down list one selected value and okay I think that s got a nod load the theme would save as well or redirect back to default aspx for the final bit of code I need is in this page and default aspx I need a new method is part of the page class called pre and it in the pre and it met recently to set our theme equal to the profile thing and that s it you this
Minute 12

Going to settings will choose some are very habit to have a nice little profile that stores your full name and the theme so although these two pieces these two concepts are these new features in ASP net and only held whole lot to do with each other you can see there you can tie them together and have a very nice I went experience for your site

No comments: