Readme for the AttributesDemo Sample
This sample (located at C:\Program Files\eBay\SDKInstallDir\Samples\ASP.NET\AttributesDemo) is
an ASP application built using the Attributes library of the eBay SDK for .NET.
This sample is similar to the Sell Your Item flow on the eBay site. This sample is for
demonstration purposes only.
This sample shows how to store attributes, add them to an item, and list the item.
In the sample, attributes data is downloaded, stored, rendered, and parsed.
This Readme file contains the following sections:
Building the Sample
- Confirm that your computer is set up to run an ASP application.
- Add basic values in the C:\Program Files\eBay\SDKInstallDir\Samples\ASP.NET\web.config file.
For example, for the Developer key, add your DevID, and for the ApiToken key, add a user token.
For more information, see the comments in the file.
- Create a virtual directory that points to your project folder.
- Set Execution Permissions to Scripts Only.
- Share the folder: In Windows 2000 or Windows XP, you can right-click
the Project folder and, under Web Sharing, choose Share This Folder.
- Build the project.
- Confirm that SelectSite.aspx is the start page.
Running the Sample
- Use the following address in your browser: http://localhost/AttributesDemo/SelectSite.aspx
- Choose the Canada site (as a test), optionally specify a category ID, and click Continue.
- Two columns of categories are displayed. You can select
two categories for your item, just as a seller does when the seller lists an item. Select two
categories and click Next.
- Confirm that the category and attribute data was saved under the C:\TEMP folder.
- Attributes are displayed that correspond to the
categories you selected. Select values for the attributes and click Continue.
- On the AddItem.aspx page, add other options as desired and click List Item to eBay.
- The View Item page for your item is displayed. Confirm that the attributes you selected are on the View Item page.
Details About the Sample
- Global.GetApiSession() is called to construct an ApiContext object.
- In SelectSites.DownloadCategories(), AttributesDemo creates an AttributesMaster
object then sets its data providers by creating implementation classes
AttributesXmlDownloader, AttributesXslDownloader and CategoryCSDownloader.
- AttributesDemo downloads the required data (attributes XML, XSL, categories, etc.)
and stores it under the C:\TEMP folder.
- AttributeInfo creates and displays an attributes HTML form to users.
User-entered information is passed back to the server as HTTP post-back data.
AttributeInfo.DisplayAttributes() calls AttributesMaster.RenderHtmlForCategories()
to create the attributes HTML form for the first time. Later,
AttributesMaster.RenderHtmlForPostback() is called to handle the HTTP post-back
from the attributes HTML form.
- AttributeInfo.AddItemNVC() shows how to extract an attribute collection
and validate the attributes collection by calling
AttributesMaster.Validate().
- AddItem.aspx creates an Item object, sets Item.Attributes to the
attributes collection, and then uses AddItemCall to list an item.