The code is given below.
Expand|Select|Wrap|Line Numbers
- Private Sub LoadProducts(ByVal grpId As Integer)
- Dim img1 As Integer = 50
- Dim PropertyFromTop As Integer = 130
- Dim PriceFromTop As Integer = 150
- Dim DescFromTop As Integer = 170
- Dim QuantityFromTop As Integer = 190
- Dim linkfromtop As Integer = 210
- Dim IdfromTop As Integer = 210
- Dim imgCount = (From s In db.TblPosts Where s.TblSubCategory2.SubCategory2Id = grpId Select s)
- For Each s In imgCount
- Dim imge1 As Image = New Image()
- Dim l1 As LinkButton = New LinkButton()
- Dim lblProperty As Label = New Label
- Dim lblPrice As Label = New Label
- Dim lblDesc As Label = New Label
- Dim lblQuantity As Label = New Label
- lblId = New Label
- l1.ID = "lnk"
- l1.Style("Position") = "Absolute"
- l1.Style("Top") = linkfromtop.ToString() & "px"
- l1.Style("Left") = "200px"
- l1.ForeColor = Drawing.Color.Blue
- imge1.Style("Position") = "Absolute"
- imge1.Style("Top") = img1.ToString() & "px"
- imge1.Style("Left") = "10px"
- imge1.Width = 180
- imge1.Height = 200
- lblProperty.Style("Position") = "Absolute"
- lblProperty.Style("Top") = PropertyFromTop.ToString() & "px"
- lblProperty.Style("Left") = "200px"
- lblProperty.ForeColor = Drawing.Color.Black
- lblPrice.Style("Position") = "Absolute"
- lblPrice.Style("Top") = PriceFromTop.ToString() & "px"
- lblPrice.Style("Left") = "200px"
- lblPrice.ForeColor = Drawing.Color.Black
- lblDesc.Style("Position") = "Absolute"
- lblDesc.Style("Top") = DescFromTop.ToString() & "px"
- lblDesc.Style("Left") = "200px"
- lblDesc.ForeColor = Drawing.Color.Black
- lblQuantity.Style("Position") = "Absolute"
- lblQuantity.Style("Top") = QuantityFromTop.ToString() & "px"
- lblQuantity.Style("Left") = "200px"
- lblQuantity.ForeColor = Drawing.Color.Black
- lblId.Style("Position") = "Absolute"
- lblId.Style("Top") = IdfromTop.ToString() & "px"
- lblId.Style("Left") = "280px"
- lblId.ForeColor = Drawing.Color.Black
- l1.Text = "Add to Cart"
- lblId.Text = s.PostId
- lblProperty.Text = "Name: " & s.PropertyName
- lblPrice.Text = "Price: " & s.Price
- lblDesc.Text = "Description: " & s.Description
- lblQuantity.Text = "Quantity: " & s.Quantity
- imge1.ImageUrl = "~/ImageHandler.ashx?Id=" + Convert.ToString(s.PostId)
- AddHandler l1.Click, AddressOf Me.LinkButon_Click
- Pnlprofile.Controls.Add(lblId)
- Pnlprofile.Controls.Add(l1)
- Pnlprofile.Controls.Add(imge1)
- Pnlprofile.Controls.Add(lblProperty)
- Pnlprofile.Controls.Add(lblPrice)
- Pnlprofile.Controls.Add(lblDesc)
- Pnlprofile.Controls.Add(lblQuantity)
- img1 = Convert.ToInt32(img1)
- img1 = img1 + 220
- IdfromTop = Convert.ToInt32(IdfromTop)
- IdfromTop = IdfromTop + 220
- linkfromtop = Convert.ToInt32(linkfromtop)
- linkfromtop = linkfromtop + 220
- PropertyFromTop = Convert.ToInt32(PropertyFromTop)
- PropertyFromTop = PropertyFromTop + 220
- PriceFromTop = Convert.ToInt32(PriceFromTop)
- PriceFromTop = PriceFromTop + 220
- DescFromTop = Convert.ToInt32(DescFromTop)
- DescFromTop = DescFromTop + 220
- QuantityFromTop = Convert.ToInt32(QuantityFromTop)
- QuantityFromTop = QuantityFromTop + 220
- Next
- End Sub
- Private Sub LinkButon_Click(ByVal sender As Object, ByVal e As System.EventArgs)
- MsgBox(lblId.Text)
- End Sub