120 likes | 141 Views
CIS 451: ASP Components. Dr. Ralph D. Westfall February, 2009. Component Definition. Component = prepackaged software object high quality, with features that are often useful commonly used items such as Buttons and TextBoxes, etc. are components. Component Sources.
E N D
CIS 451: ASP Components Dr. Ralph D. Westfall February, 2009
Component Definition • Component = prepackaged software object • high quality, with features that are often useful • commonly used items such as Buttons and TextBoxes, etc. are components
Component Sources • Microsoft provides components with Visual Studio and VWDX in the ToolBox • 3rd party vendors and open source • create yourself • book on creating components
ToolBox Components • Standard • AdRotator - rotates "banner ads" • Calendar – for showing year, month etc. on a page • FileUpload – for submitting files • Ajax Extensions • for integrating client side JavaScript into ASP.NET applications
Example: Ad Rotator • rotating "banner ads" is a common E-commerce function • showing different ads instead of same one • payment based on how often ad is shown • frequency is based on input factors • can show some more often e.g. • ad A 80% of time • ad B 20% of time
AdRotator: Tutorial, Tutorial • create ASP.NET web site • right click Project Name, New Folder> rename it to Images • find 3 images (or create) • Image>Attributes: Width 190, Height 50 • add content that looks like advertisement
Put AdRotator on Form • drag/drop AdRotator from Standard section of Toolbox onto form • Layout>Position>Auto-position Options>Absolutely positioned>OK • drag AdRotator to top center • could resize it to size of images (190 x 50)
Ad Rotator Parameters • key ones can be set in [file].xml file • links to images <ImageUrl> • link to advertiser <NavigateUrl> • alt text <AlternateText> • relative frequency # <Impressions> • can set some in Properties window also • colors, borders, height, width, etc.
Configure Ad Content • create an XML file • right-click App_Data folder in Solution Explorer>Add new Item>XML File: [file name].xml>Add • double-click XML file name to edit it
Configure Ad Content - 2 • paste content from tutorial into XML file • change the values for ImageURLs to paths of images (~/images/[image file name]) • may modify other XML content items • add <Impressions> elements to give relative frequencies
Configuration • Data Source • click smart tag>New data source>XML file>OK>Data File>Browse>select>OK>OK • Adding hyperlink content via a new XML tag • ASP.NET AdRotator - Basic and Extending • and/or could also use to add text to a label
Exercise • create a page, add an AdRotator to it • create/find images, configure xml file • estimate relative frequencies of each one of three ads • use refresh button to reload, and count how many times each ad appears • try to tell if there is any pattern