|
xxx
C# - Amazon User Control
by Charles Carroll
Here is the page that dispays the Amazon book covers
filename=/experiments/cs_amazon/testbooks.aspx
<%@ Register TagPrefix="bookshow" tagname="cover" src="amazon.ascx"%>
<html><head>
<title>Amazon Test</title>
</head>
<body>
<bookshow:cover ISBN="0517887290" promocode="learnasp" runat="server"/><br>
<bookshow:cover ISBN="0385484992" promocode="learnasp" runat="server"/><br>
<bookshow:cover ISBN="0451169530" promocode="learnasp"
height=210 width=160 runat="server"/><br>
<bookshow:cover ISBN="0553283685" promocode="learnasp"
height=210 width=160 runat="server"/><br>
</body>
</html>
Here is the User Control that does all the work
filename=/experiments/cs_amazon/amazon.ascx
<script runat="server" language="c#">
public string Isbn;
public int Height=80;
public int Width=55;
public string LocalGraphic=null;
public string PromoCode="learnasp";
protected void Page_Load(Object S, EventArgs E)
{
Book.NavigateUrl="http://www.amazon.com/exec/obidos/ISBN=" +
Isbn + "/" + PromoCode;
if (LocalGraphic==null)
{
BookCover.ImageUrl="http://images.amazon.com/images/P/"
+ Isbn + ".01.MZZZZZZZ.jpg";
}
else
{
BookCover.ImageUrl=LocalGraphic;
}
BookCover.AlternateText="Amazon:" + Isbn;
BookCover.Height=Unit.Pixel(Height);
BookCover.Width=Unit.Pixel(Width);
}
</script>
<asp:hyperlink id="Book" runat="server">
<asp:Image ID="BookCover" runat="server" />
</asp:hyperlink>
 |  |  |
 |
There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too.
a $5 tip buys him lunch at McDonalds,
a $20 tip buys his kid Hitoshi a new computer game,
a $39 tip buys his daughter Michiko a few nice outfits.
See our donor list.
|  |
 |  |  |
|
|
|
|