Advertisement

12.18.2007 at 11:43AM PST, ID: 23031649
[x]
Attachment Details

dynamically build a three or four column  table that is databound. each column should have a new record

Asked by jcook32 in Programming for ASP.NET

Tags: asp.net

I have a table that I build in the code behind based on a dataset that i return.
I have the table working where it has one td in each row but what i want is to have three td's for each row.
now each td will contain the next record in the database which is a picture.

when the table is build i want to add a row then add 3 records from the database before i close the row and start another one.
sample code of what i have.

 While myDR.Read
            Dim x As Integer = 0
           
            myThumbViewer = New ThumbViewer
            myThumbViewer2 = New ThumbViewer
            myThumbViewer3 = New ThumbViewer
            myLabel = New Label
            myLabel2 = New Label
            myLabel3 = New Label
            myRow = New TableRow
            myCell = New TableCell
            myCell2 = New TableCell
            myCell3 = New TableCell


              With myThumbViewer
                .Height = "150"
                .Width = "200"
                .ModalFixedHeight = "300"
                .ModalFixedWidth = "400"
                .ModalImagePadding = "50"
                .CssClass = "textboxbold"
                .ImageUrl = "~/images/" & myDR("PhotoName")
                .ThumbUrl = "~/images/" & myDR("PhotoName") 'Response.OutputStream.Write(myDR("Photo"), 0, CInt(myDR("length")))
                .Title = myDR("Description")
            End With

            With myLabel
                .Text = myDR("Description")
                .CssClass = "photodesc"
            End With

            '************************************************************
            'With myThumbViewer2
            '    .Height = "200"
            '    .Width = "200"
            '    .CssClass = "textboxbold"
            '    .ImageUrl = "~/images/" & myDR("PhotoName")
            '    .ThumbUrl = "~/images/" & myDR("PhotoName")
            '    .Title = "Same as photo Descr2"
            'End With

            'With myLabel2
            '    .Text = "Sample Photo Description2"
            '    .CssClass = "photodesc"
            'End With
            ''************************************************************
            'With myThumbViewer3
            '    .Height = "200"
            '    .Width = "200"
            '    .CssClass = "textboxbold"
            '    .ImageUrl = "~/images/" & myDR("PhotoName")
            '    .ThumbUrl = "~/images/" & myDR("PhotoName")
            '    .Title = "Same as photo Descr3"
            'End With

            'With myLabel3
            '    .Text = "Sample Photo Description3"
            '    .CssClass = "photodesc"
            'End With
            '************************************************************
            With myCell
                '.ColumnSpan = 3
                .Controls.Add(myThumbViewer)
                .Controls.Add(myLabel)
            End With
            'With myCell2
            '    '.ColumnSpan = 3
            '    .Controls.Add(myThumbViewer2)
            '    .Controls.Add(myLabel2)
            'End With

            'With myCell3
            '    '.ColumnSpan = 3
            '    .Controls.Add(myThumbViewer3)
            '    .Controls.Add(myLabel3)
            'End With
            myCell.Controls.Add(myThumbViewer)
            myCell.Controls.Add(myLabel)
            'myCell2.Controls.Add(myThumbViewer2)
            'myCell2.Controls.Add(myLabel2)
            'myCell3.Controls.Add(myThumbViewer3)
            'myCell3.Controls.Add(myLabel3)
            myRow.VerticalAlign = VerticalAlign.Top
            myRow.Cells.Add(myCell)
            'myRow.Cells.Add(myCell2)
            'myRow.Cells.Add(myCell3)
            'If x = 3 Then
            myTable.Rows.Add(myRow)
            ' End If
            With myLiteralControlBR
                .Text = "<br>"
            End With
            x = x + 1
        End WhileStart Free Trial
1:

           
[+][-]12.31.2007 at 08:06AM PST, ID: 20555690

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Programming for ASP.NET
Tags: asp.net
Sign Up Now!
Solution Provided By: Pichto
Participating Experts: 1
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628