I am converting a xls to web form. THere are 4 fields and XX # of lines per form entry. Since the number of lines are variable I want to have an "+Add Line" Button to add a line of txt boxes to the form. I have gotten it to work ...but it will only add One new line of txtboxes... Please advise...here is my code.

Partial Class _Default
    Inherits System.Web.UI.Page

    Dim OfficeEquipment(100) As TextBox
    Dim OfficePrice(100) As TextBox
    Dim OfficeQuantity(100) As TextBox
    Dim OfficeTotal(100) As Label
    Dim OfficeDiv(400) As Panel

    Dim BuisnessCenterEquipment(100) As TextBox
    Dim BuisnessCenterPrice(100) As TextBox
    Dim BuisnessCenterQuantity(100) As TextBox
    Dim BuisnessCenterTotal(100) As Label
    Dim BuisnessDiv(400) As Label

    Dim SoftwareEquipment(100) As TextBox
    Dim SoftwarePrice(100) As TextBox
    Dim SoftwareQuantity(100) As TextBox
    Dim SoftwareTotal(100) As Label
    Dim SoftwareDiv(400) As Panel

    Dim RowDiv(100) As Panel



    Protected Sub btnAddRow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddRow.Click

        Dim cnt As Integer = Session("OfficeRows") + 1
        Dim divcnt As Integer = Session("DivCnt")
        RowDiv(cnt) = New Panel
        RowDiv(cnt).CssClass = "Row"
        phOfficeEquipment.Visible = True

        phOfficeEquipment.Controls.Add(RowDiv(cnt))


        OfficeDiv(divcnt) = New Panel
        OfficeEquipment(cnt) = New TextBox
        OfficeDiv(divcnt).ID = "OfficeDiv" & divcnt
        OfficeDiv(divcnt).CssClass = "EquipmentListing Equipment"
        OfficeEquipment(cnt).ID = "OfficeEquipment" & cnt
        OfficeEquipment(cnt).CssClass = "WorksheetInputStyle"
        RowDiv(cnt).Controls.Add(OfficeDiv(divcnt))
        OfficeDiv(divcnt).Controls.Add(OfficeEquipment(cnt))
        divcnt += 1

        OfficeDiv(divcnt) = New Panel
        OfficePrice(cnt) = New TextBox
        OfficeDiv(divcnt).ID = "OfficeDiv" & divcnt
        OfficeDiv(divcnt).CssClass = "EquipmentListing Price"
        OfficePrice(cnt).ID = "OfficePrice" & cnt
        OfficePrice(cnt).CssClass = "WorksheetInputStyle"
        RowDiv(cnt).Controls.Add(OfficeDiv(divcnt))
        OfficeDiv(divcnt).Controls.Add(OfficePrice(cnt))
        divcnt += 1

        OfficeDiv(divcnt) = New Panel
        OfficeQuantity(cnt) = New TextBox
        OfficeDiv(divcnt).ID = "OfficeDiv" & divcnt
        OfficeDiv(divcnt).CssClass = "EquipmentListing Quantity"
        OfficeQuantity(cnt).ID = "OfficeQuantity" & cnt
        OfficeQuantity(cnt).CssClass = "WorksheetInputStyle"
        RowDiv(cnt).Controls.Add(OfficeDiv(divcnt))
        OfficeDiv(divcnt).Controls.Add(OfficeQuantity(cnt))
        divcnt += 1

        OfficeDiv(divcnt) = New Panel
        OfficeTotal(cnt) = New Label
        OfficeDiv(divcnt).ID = "OfficeDiv" & divcnt
        OfficeDiv(divcnt).CssClass = "EquipmentListing Quantity"
        OfficeTotal(cnt).ID = "OfficeQuantity" & cnt
        OfficeTotal(cnt).CssClass = "Totals"
        OfficeTotal(cnt).Text = "$"
        RowDiv(cnt).Controls.Add(OfficeDiv(divcnt))
        OfficeDiv(divcnt).Controls.Add(OfficeTotal(cnt))
        divcnt += 1

        Session("DivCnt") = divcnt
        Session("OfficeRows") = Session("OfficeRows") + 1
        OfficeEquipment(cnt).Text = cnt
        OfficeTotal(cnt).Text = divcnt

    End Sub

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


    End Sub
End Class

use literal control to generate a HTML

use literal control to generate a HTML

Ok WOW... I must say I feel a bit stupid. What a waste of a few days work :P.. The Literal works great! One issue. Is there a simple way to retain Form data (from the added literal controls) when adding to a literal?

please describe your requirement in brief..!

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.