<%@ Page Language="VB" MasterPageFile="~/HalamanMaster.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" title="Halaman Utama" %>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
<table cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" style="font-size: 10pt; width: 100%; font-family: Tahoma" valign="top">
<strong>Selamat Datang di Bamboomedia ShoppingCart
<br />
</strong>Disini kami <span style="font-family: Tahoma">menyediakan</span> fasilitas
shopping cart untuk produk-produk bamboomedia yaitu Media Belajar Interaktif melalui
PC CD ROM, Melalui Website ini anda dapat berbelanja dengan mudah dan cepat.</td>
</tr>
<tr>
<td align="left" style="font-size: 10pt; width: 100%; font-family: Tahoma" valign="top">
 
</td>
</tr>
<tr>
<td align="left" style="font-size: 10pt; width: 100%; font-family: Tahoma; height: 16px;
background-color: gainsboro" valign="top">
Produk Terbaru Bamboomedia</td>
</tr>
<tr>
<td align="left" style="font-size: 10pt; width: 100%; font-family: Tahoma; height: 16px"
valign="top">
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ShoppingCartConnectionString %>"
SelectCommand="SELECT [KodeBarang], [NamaBarang], [Harga], [Keterangan], [FileGambar] FROM [TBLBarang] WHERE ([StatusBaru] = @StatusBaru)">
<SelectParameters>
<asp:Parameter DefaultValue="1" Name="StatusBaru" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
<HeaderTemplate>
<table cellpadding="0" cellspacing="0" width="100%">
</HeaderTemplate>
<ItemTemplate>
<tr>
<td align="left" style="width: 10%" valign="top">
<asp:Image ID="imgGambar" runat="server" ImageUrl='<%# "~/Image_Produk/" & Eval("FileGambar") %>' /></td>
<td align="left" style="width: 1px" valign="top">
</td>
<td align="left" style="width: 89%" valign="top">
<asp:Label ID="KodeBarang" runat="server" Text='<%# Eval("KodeBarang") %>'></asp:Label><br />
<asp:Label ID="NamaBarang" runat="server" Text='<%# Eval("NamaBarang") %>'></asp:Label><br />
<asp:Label ID="Harga" runat="server" Text='<%# Eval("Harga", "{0:n}") %>'></asp:Label><br />
<asp:TextBox ID="Jumlah" Text="1" runat="server" Width="25px"></asp:TextBox>
<asp:Button ID="butBeli" runat="server" CommandName="Beli" Text="Beli" PostBackUrl="~/Kasir.aspx?from=def"/></td>
</tr>
<tr>
<td align="left" colspan="3" valign="top">
<asp:Label ID="Keterangan" runat="server" Text='<%# Eval("Keterangan") %>'></asp:Label></td>
</tr>
<tr>
<td align="left" style="width: 10%" valign="top"> 
</td>
<td align="left" style="width: 1px" valign="top">
</td>
<td align="left" style="width: 89%" valign="top">
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
</td>
</tr>
<tr>
<td align="left" style="font-size: 10pt; width: 100%; font-family: Tahoma; height: 16px"
valign="top">
</td>
</tr>
</table>
</asp:Content>
DEFAULT.ASPX.VB nya
Partial Class _Default
Inherits System.Web.UI.Page
' Difinisi variabel untuk Barang yang dipilih '
Private kodeBarang As String = ""
Private namaBarang As String = ""
Private jumlahBarang As Integer = 0
Private hargaBarang As Double = 0
Public Function dataList() As ArrayList
' Barang yang dipilih disimpan dalam Array List
Dim itemPilihan As ArrayList = New ArrayList
itemPilihan.Add(kodeBarang)
itemPilihan.Add(namaBarang)
itemPilihan.Add(jumlahBarang)
itemPilihan.Add(hargaBarang)
dataList = itemPilihan
End Function
Protected Sub Repeater1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles Repeater1.ItemCommand
' Barang yang dipilih disimpan dalam variabel
kodeBarang = CType(Repeater1.Items(e.Item.ItemIndex).FindControl("KodeBarang"), Label).Text
namaBarang = CType(Repeater1.Items(e.Item.ItemIndex).FindControl("NamaBarang"), Label).Text
jumlahBarang = CInt(CType(Repeater1.Items(e.Item.ItemIndex).FindControl("Jumlah"), TextBox).Text)
hargaBarang = CType(Repeater1.Items(e.Item.ItemIndex).FindControl("Harga"), Label).Text
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
' Inisialisasi variabel
jumlahBarang = 0
kodeBarang = ""
namaBarang = ""
hargaBarang = 0
End Sub
End Class
Tidak ada komentar:
Posting Komentar