Personalization | in Visual Studio .NET

Print QR in Visual Studio .NET Personalization |

Personalization |
QR Code JIS X 0510 Generation In .NET
Using Barcode drawer for ASP.NET Control to generate, create Quick Response Code image in ASP.NET applications.
www.OnBarcode.com
Barcode Creation In .NET
Using Barcode drawer for ASP.NET Control to generate, create Barcode image in ASP.NET applications.
www.OnBarcode.com
Complex data types
Printing UCC - 12 In VS .NET
Using Barcode creation for ASP.NET Control to generate, create EAN128 image in ASP.NET applications.
www.OnBarcode.com
Creating PDF 417 In Visual Studio .NET
Using Barcode encoder for ASP.NET Control to generate, create PDF-417 2d barcode image in ASP.NET applications.
www.OnBarcode.com
The information we ve saved so far in the profile has been simple (built-in) data, but of course you may want to save either user-defined types or collections. These are considered complex data types and require just a bit of extra work, as you ll see with the Sports profile information in the very next example. Close the browser and copy the previous example, SitePersonalization, to a new web site called SitePersonalizationComplex. Set the Welcome page as the Start page and run the site to verify that everything works. In this web site, you will add a CheckBoxList control to the ProfileInfo page so users can select their favorite sports and store them in a profile using a StringCollection object. Add a new property, called Sports, of type StringCollection, to the profile element in web.config, as indicated by the highlighted line of code in Example 9-4.
Generate QR Code In VS .NET
Using Barcode encoder for ASP.NET Control to generate, create QR Code JIS X 0510 image in ASP.NET applications.
www.OnBarcode.com
Universal Product Code Version A Maker In .NET
Using Barcode drawer for ASP.NET Control to generate, create UPC Symbol image in ASP.NET applications.
www.OnBarcode.com
<profile enabled="true" defaultProvider="AspNetSqlProfileProvider"> <properties> <add name="lastName" /> <add name="firstName" /> <add name="phoneNumber" /> <add name="birthDate" type="System.DateTime" /> <add name="Sports" type="System.Collections.Specialized.StringCollection" /> </properties> </profile>
EAN13 Drawer In .NET Framework
Using Barcode creator for ASP.NET Control to generate, create GTIN - 13 image in ASP.NET applications.
www.OnBarcode.com
Encode British Royal Mail 4-State Customer Code In VS .NET
Using Barcode printer for ASP.NET Control to generate, create RM4SCC image in ASP.NET applications.
www.OnBarcode.com
VB CHEAT SHEET
Create QR-Code In Visual Studio .NET
Using Barcode creation for ASP.NET Control to generate, create QR-Code image in ASP.NET applications.
www.OnBarcode.com
QR-Code Maker In Objective-C
Using Barcode encoder for iPhone Control to generate, create QR Code image in iPhone applications.
www.OnBarcode.com
StringCollection Class
Decode Barcode In None
Using Barcode decoder for Software Control to read, scan read, scan image in Software applications.
www.OnBarcode.com
EAN 13 Reader In None
Using Barcode reader for Software Control to read, scan read, scan image in Software applications.
www.OnBarcode.com
The StringCollection class, which is a member of the System.Collections. Specialized namespace, is used to represent a collection of strings. Elements within the collection can be accessed using a zero-based integer index. A number of methods are provided for manipulating the collection, including the ability to add items, find the index of specific items, and remove items either by index or by specifying the string.
Paint Barcode In Java
Using Barcode creation for Java Control to generate, create Barcode image in Java applications.
www.OnBarcode.com
ANSI/AIM Code 128 Encoder In Objective-C
Using Barcode drawer for iPad Control to generate, create Code 128 image in iPad applications.
www.OnBarcode.com
Edit the page ProfileInfo.aspx. Add a row to the layout table above the Save button and put a CheckBoxList control in that row name it cblSports. In Design view, click the Smart Tag of the CheckBoxList and click Edit Items . Add several sports to the ListItem Collection Editor dialog box, as shown in Figure 9-31.
EAN 13 Recognizer In VB.NET
Using Barcode recognizer for .NET Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
UPC-A Supplement 2 Maker In None
Using Barcode generator for Font Control to generate, create UPC-A Supplement 2 image in Font applications.
www.OnBarcode.com
|
GS1 - 13 Recognizer In C#
Using Barcode decoder for VS .NET Control to read, scan read, scan image in .NET framework applications.
www.OnBarcode.com
Barcode Decoder In .NET
Using Barcode scanner for .NET Control to read, scan read, scan image in Visual Studio .NET applications.
www.OnBarcode.com
9: Security and Personalization
Making QR In VS .NET
Using Barcode maker for Reporting Service Control to generate, create Denso QR Bar Code image in Reporting Service applications.
www.OnBarcode.com
Creating Code 128A In Java
Using Barcode creation for Java Control to generate, create Code 128 Code Set A image in Java applications.
www.OnBarcode.com
Now you need to enhance the event handler for the Save button to add the selected items to the new Profile property, as shown in the highlighted code in Example 9-5.
Protected Sub btnSave_Click(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles btnSave.Click If Profile.IsAnonymous = False Then Profile.lastName = Me.txtLastName.Text Profile.firstName = Me.txtFirstName.Text Profile.phoneNumber = Me.txtPhone.Text Profile.birthDate = CType(Me.txtBirthDate.Text, System.DateTime) Profile.Sports = New System.Collections.Specialized.StringCollection( ) For Each item As ListItem In Me.cblSports.Items If item.Selected Then Profile.Sports.Add(item.Value.ToString( )) End If Next End If Response.Redirect("Welcome.aspx") End Sub
You also need to create an event handler for the Page Load event, so the page will open with the user s up-to-date profile information. Create that event the same way you did earlier, and then add the body of the method, highlighted in Example 9-6.
Personalization |
Protected Sub Page_Load(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack And Profile.UserName IsNot Nothing Then If Profile.IsAnonymous = False Then Me.txtLastName.Text = Profile.lastName Me.txtFirstName.Text = Profile.firstName Me.txtPhone.Text = Profile.phoneNumber Me.txtBirthDate.Text = Profile.birthDate.ToShortDateString( ) End If If Profile.Sports IsNot Nothing Then For Each item As ListItem In Me.cblSports.Items For Each profileString As String In Profile.Sports If item.Text = profileString Then item.Selected = True End If Next Next End If End If End Sub
Each time you navigate to the Profile page, the values are updated from the existing profile (if any) in Page_Load and you are free to change them and save the new values, as shown in Figure 9-32. However, after you save this page and go back to the Welcome page, the sports selections are not displayed. To do so, add a ListBox control, called lbSports, to the already existing Panel control pnlInfo, as shown in Figure 9-33. The selections will be displayed in lbSports. Modify the pre-existing Page_Load sub in Welcome.aspx.vb to bind the contents of the Profile.Sports property to the ListBox, by adding the highlighted code from Example 9-7.
Protected Sub Page_Load(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Me.Load If User.Identity.IsAuthenticated = True Then btnManagersPage.Enabled = True Else btnManagersPage.Enabled = False End If If Not IsPostBack And _ Profile.UserName IsNot Nothing And _ Profile.IsAnonymous = False Then
|
Copyright © OnBarcode.com . All rights reserved.