View Single Post
Old April 21st, 2007, 10:09 AM
darren0 darren0 is offline
Registered User
Join Date: Apr 2007
Location: hengoed, mid glamorgan, United Kingdom.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to darren0
Default Wrox beginning asp.NET 2.0 (e-commerce section)

Hi all, i have a problem when executing my application following the book descibed above, when building an index page for a product catalog and its interaction with a Product Item page. Ill try to be as consise as possible, and will post some code if requested. I'm presuming ive followed the book perfectly but still get an error.

1)added new item shop.aspx, added SqlDataSource control and successfully connects to my database, in order to read from a list of products. Consequently added required fields from products table using wizard

2)Added DataList control, selected SqlDataSource, edited templates to remove un-needed descriptions of ProductID etc. Deleted Picture URL label and replaced this with an image button. Then edited the data bindings for this image button entered a custom binding of the following code:

Eval ("PictureURL", "ProductImages\thumb_{0}")

3) selected custom binding for PriceLabel and set this to currency, and another trivial matter of changing Datalist properties from vertical to horizontal and no of colums to 4.

4)Run the page and it shows a successfull result in the browser, with Product details and images from SQL database (obviously the image button has no effect as of yet!!

5) added new item to the project called ShopItem.aspx (product item page which should be displayed when a user selects a product, giving more details etc)

6)added SqlDataSource control again, selected the relevant connectionstring. Once again selected the Products table from my database to read from, with the difference of entering a WHERE clause.

7)WHERE clause: column id from the column drop down list, query string from source and entered ProductID in the query string field. Therefore matching the product which the user selects from shop.aspx.

8)added datalist to ShopItem.aspx selected sqldatasource1 from the data source drop down list.

9)edited templates again and deleted all of the text alongside the labels, moving the pictureURL to the top.

10) i changed the pictureURL (in my database this column contains the images) URL of the image being displayed.

11)An image control was added, edited data bindings to a custom binding of: Eval ("PictureURL","ProductImages\{0}")
To this point both pages compile fine - no errors.

12)hyperlink added below the datalist control in shopItem.aspx and changed the navigateURL property to ~/Shop.aspx, so user can return back to the original page.

13)the application works fine up to this point, accessing the shopItems.aspx page and selecting the hyperlink takes me to shop.aspx.

14) Now this is wear things go wrong. going back to design view in Shop.aspx editing the datalist control, and the image button properties to make a postbackURL custom binding of:

Eval "ProductID", "ShopItem.aspx?ProductID={0}".

Execting the project takes me to Shop.aspx, but when i select on of the images from the product catalog i get an error. Also browsing to ShopItem.aspx directly allows me to go back to Shop.aspx without error.

I apologise for the length of the post, but i wanted to be consise, ive run this over and over today, ive carrid out the steps correctly in visual studio 2005 but the image button result in errors.

Please help if you can, ill post error info or code if needed.

Thanks all the same