Click here to Skip to main content
13,799,868 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
This is my html code:

<%@ Page Title="Magbenta.com.ph" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false" CodeBehind="Home.aspx.vb" Inherits="websiteko.Home" %>

<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
    <div class="jumbotron header-banner">
        <asp:TextBox placeholder="Looking for..." CssClass="form-control search-text" runat="server"></asp:TextBox> <asp:Button Text="Search" CssClass="btn btn-default" runat="server"/><asp:Button Text="View All Items" CssClass="btn btn-default view-all" runat="server"/>
    </div>
    <div class="jumbotron jumbotron-items">
        <asp:PlaceHolder ID = "PlaceHolder1" runat="server" />
    </div>
</asp:Content>


This is my vb.net code:

<pre>Imports System.Data.SqlClient
Imports System.Data
Imports System.Text
Imports System.Configuration
Public Class Home
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        grid_display()
    End Sub


    Protected Sub grid_display()

        Dim ds As New DataSet
        Dim cmd As String

        cmd = "SELECT * FROM t_Items"
        ds = Executequery(cmd)
        Dim html As New StringBuilder()
        html.Append("<table border = '0' class='tbl-item'>")
        For i = 0 To ds.Tables(0).Rows.Count - 1
            If i Mod 3 = 0 Then
                html.Append("<tr class='tr-holder'>")
                html.Append("<td class='price-holder'><img class='image-hover' src='" & ds.Tables(0).Rows(i)("imagepath") & "' width='120' height='100'/>")
                html.Append("<div class='details-holder' height='100' width='120'>" & ds.Tables(0).Rows(i)("itemprice") & "<a href=''><h5 class='item-description'>" & ds.Tables(0).Rows(i)("ItemDescription") & "</h5></a><p><h5 class='date-posted'>Posted Date: " & ds.Tables(0).Rows(i)("DatePosted") & "</h5></h5></div>")
                html.Append("</td>")
            Else
                html.Append("<td class='price-holder'><img class='image-hover' src='" & ds.Tables(0).Rows(i)("imagepath") & "' width='120' height='100'/>")
                html.Append("<div class='details-holder' height='100' width='120'>" & ds.Tables(0).Rows(i)("itemprice") & "<a href=''><h5 class='item-description'>" & ds.Tables(0).Rows(i)("ItemDescription") & "</h5></a><p><h5 class='date-posted'>Posted Date: " & ds.Tables(0).Rows(i)("DatePosted") & "</h5></h5></div>")
                html.Append("</td>")
            End If

        Next
        html.Append("</tr>")
        html.Append("</table>")

        'Append the HTML string to Placeholder.
        PlaceHolder1.Controls.Add(New Literal() With {
           .Text = html.ToString()
         })
    End Sub

End Class


What I have tried:

Actually I don't know how to do it. I've search a lot of tutorials in google and youtube but still i'm struggling to find a way to do it.

Can anyone provide me code for it in a way that will match on how i did the displaying of my data?

Please I need it so bad. Thank you so much in advance.
Posted 12-Mar-17 7:02am

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web06 | 2.8.181214.1 | Last Updated 12 Mar 2017
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100