Okay, I have found a suggested C# solution that syntatically ported to VB.NET seemed to look right however getting a Null pointer exception when i try to get data from the control..
Using a user control as basically 1 label 1 multiline textbox and 2 textboxes
wrote a ItemBound function in the forms codebehind and a setData in the code behind for the control...
............... ..sets great.......... ..just can't seem to figure out how to get the data back from the textboxes (user edits) or label without this Null Pointer Exception
Code:
Dim details As New objFilingDetails
Dim item As RepeaterItem
For Each item In Repeater1.Items
'the repeater contains datarow views, each row 3 textboxes, 1 label
Dim dtrow As Data.DataRowView = CType(item.DataItem, Data.DataRowView)
'gets to here....mouse over in debug shows item.DataItem is Nothing
'however does show two items in Repeater1.Items
details.Description = (CType(dtrow.Item("txtbx_Documents"), TextBox)).Text
details.FAA_Advance = Decimal.FromOACurrency((CType(dtrow.Item("txtbx_FAAFee"), TextBox)).Text)
details.Aero_Fee = Decimal.FromOACurrency((CType(dtrow.Item("txtbx_AeroFee"), TextBox)).Text)
details.FAA_Number = (CType(dtrow.Item("lbl_FAANo"), Label)).Text
objFiling.Details.Add(details)
Next
wrote a ItemBound function in the forms codebehind and a setData in the code behind for the control...
Code:
Private Sub Repeater1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles Repeater1.ItemDataBound
If (e.Item.ItemType = ListItemType.Item) Then
CType(e.Item.FindControl("filing"), _
filingControl).SetData(CType(e.Item.DataItem, _
Data.DataRowView), False)
End If
If (e.Item.ItemType = ListItemType.AlternatingItem) Then
CType(e.Item.FindControl("filing"), _
filingControl).SetData(CType(e.Item.DataItem, _
Data.DataRowView), True)
End If
End Sub
Public Sub SetData(ByVal dr As Data.DataRowView, ByVal IsAlternating As Boolean)
Me.lbl_FAANo.Text = dr("FAA_Number")
Me.txtbx_Documents.Text = dr("Description")
Me.txtbx_FAAFee.Text = FormatCurrency(dr("FAA_Advance"), 2)
Me.txtbx_AeroFee.Text = FormatCurrency(dr("Aero_Fee"), 2)
If IsAlternating Then
Panel1.BackColor = Drawing.Color.LightGoldenrodYellow
End If
End Sub
............... ..sets great.......... ..just can't seem to figure out how to get the data back from the textboxes (user edits) or label without this Null Pointer Exception
Comment