Hello I am using VS 2010 while following Video tutorial for VS 2005. I thought it would be just the same thing. I am using .NET 4 framework. I suppose to see on screen product page with complete data, except this time, I do not see the data. I do not see all the Text='<%# Eval("Field") %>'> values. why is it?

If because of version differences, what it suppose to be in .NET 4.0 ?

Default.aspx

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <table cellpadding="0" cellspacing="0" class="style1" 
        style="width: 100%; font-size: 10px; text-align: left;">
        <tr>
            <td class="style3" 
                style="font-family: Arial, Helvetica, sans-serif; font-size: 10px;">
                Selamat Datang di Bamboo Media ShoppingCart<br />
                <br />
                Di sini kami menyediakan 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 class="style4">
                 </td>
        </tr>
        <tr>
            <td class="style5" style="font-family: Arial, Helvetica, sans-serif">
                Produk Terbaru Bamboomedia</td>
        </tr>
        <tr>
            <td class="style4">
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ShoppingCartConnectionString %>" 
                    SelectCommand="SELECT [NamaBarang], [Harga], [FileGambar], [Keterangan] 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">
                </asp:Repeater>
                <br />

                <HeaderTemplate>
                <table cellpadding="0" cellspacing="0" class="style1">
                </HeaderTemplate>

                <ItemTemplate>
                    <tr>
                        <td align="left" class="style6" valign="top" width="100px">
                            <asp:Image ID="imgGambar" runat="server" Width="16px" ImageUrl = '<%# "~/Image_Produk/" & Eval("FileGambar") %>' />
                        </td>
                        <td align="left" class="style6" valign="top" width="1px">
                        </td>
                        <td id="NamaBarang" align="left" class="style6" 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="NamaBarang2" runat="server" Text='<%# Eval("Harga", "{0:n}") %>'></asp:Label>
                            <br />
                            <asp:TextBox ID="Jumlah" runat="server" Width="53px"></asp:TextBox>
                            <asp:Button ID="Button1" runat="server" Text="butBeli" PostBackUrl="~/Kasir.aspx"/>
                        </td>
                    </tr>
                    <tr>
                        <td class="style7" colspan="3" width="100px">
                            <asp:Label ID="Keterangan" runat="server" Text="Label"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td width="100px">
                             </td>
                        <td width="1px">
                             </td>
                        <td>
                             </td>
                    </tr>
                    </ItemTemplate>

                <FooterTemplate>
                </table>
                </FooterTemplate>

            </td>
        </tr>
    </table>
</asp:Content>

Recommended Answers

All 3 Replies

Line 31 should be at line 74

You closed the repeater, before adding the content.

Those header, item and footer templates should be within the repeater control as ggamble mentioned. If you are using VS on the design page, as you work with the controls, they will be created correctly. Are you manually typing this out on the source view?

Your also using 'NamaBarang' twice as an ID. ID parameters need to be unique.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.