Yes please, more help if you can...
What I'm doing loop through records and create a usercontrol per loop. The usercontrol is a table containing textboxes and labels.
The textbox values (usercontrol properties) will be changed by the user, after which they click a button. I need to update those values in the user control as well as save them to the dbase.
I have no idea how to get each control's property values once they've been updated, and keep the controls visible (viewstate as you suggest).
So here follows the code. Thanks Mark.
'Usercontrol PartPricing.ascx.vb
'----
Public MustInherit Class PartPricing
Inherits System.Web.UI.UserControl
Protected WithEvents txtMarkup As System.Web.UI.WebControls.TextBox
Protected WithEvents txtPrice As System.Web.UI.WebControls.TextBox
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Public Property Price() As Decimal
Get
Return txtPrice.Text
End Get
Set(ByVal Value As Decimal)
Try
txtPrice.Text = Value
Catch
End Try
End Set
End Property
Public Property MarkupPercentage() As Decimal
Get
Return txtMarkup.Text
End Get
Set(ByVal Value As Decimal)
Try
txtMarkup.Text = Value
Catch
End Try
End Set
End Property
End Class
'----
.aspx page
'----
Public Class TestPricing
Inherits System.Web.UI.Page
Protected WithEvents btnUpdate As System.Web.UI.WebControls.Button
Protected WithEvents panelPricing As System.Web.UI.WebControls.Panel
Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
InitializeComponent()
End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
GetPartPricingDetails()
End Sub
Private Sub GetPartPricingDetails()
Dim iPartsPricingCount As Integer
'Create a holding table to hold pricing parts tables
Dim holderTable As New Table()
Dim myRow As TableRow
'Create instances of the row
myRow = New TableRow()
'Get part pricing details
Dim sCustomer As New Customers()
Dim sReader As SqlDataReader
sReader = sCustomer.GetQuotePartPricingDetails(CInt(lblPartDetailsID.Text), lblPartID.Text)
Dim iMarkup, iPrice
While sReader.Read
'Create a new table cell
Dim myCell As TableCell
myCell = New TableCell()
iMarkup = sReader("percentage_markup"

iPrice = sReader("price"
Dim PartPricing1 As PartPricing = CType(Page.LoadControl("~/Controls/PartPricing.ascx"

, PartPricing)
PartPricing1.ID = "partPricing_" & CStr(iPartsPricingCount)
PartPricing1.Price = iPrice
PartPricing1.MarkupPercentage = iMarkup
'Add partpricing user control to the cell
myCell.Controls.Add(PartPricing1)
myCell.ID = "cell_" & iPartsPricingCount
'Add the cell to the row
myRow.Cells.Add(myCell)
iPartsPricingCount += 1
End While
'Add the row to the table
holderTable.Rows.Add(myRow)
panelPricing.Controls.Add(holderTable)
End Sub
End Class