Get Data from Repeater Control - ASP.NET - VB.NET

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jcas1411
    New Member
    • Mar 2008
    • 4

    Get Data from Repeater Control - ASP.NET - VB.NET

    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..

    Dim details As New objFilingDetail s
    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.DataRowVie w = CType(item.Data Item, Data.DataRowVie w)

    'gets to here....mouse over in debug shows item.DataItem is Nothing
    'however does show two items in Repeater1.Items

    details.Descrip tion = (CType(dtrow.It em("txtbx_Docum ents"), TextBox)).Text
    details.FAA_Adv ance = Decimal.FromOAC urrency((CType( dtrow.Item("txt bx_FAAFee"), TextBox)).Text)
    details.Aero_Fe e = Decimal.FromOAC urrency((CType( dtrow.Item("txt bx_AeroFee"), TextBox)).Text)
    details.FAA_Num ber = (CType(dtrow.It em("lbl_FAANo") , Label)).Text

    objFiling.Detai ls.Add(details)

    Next


    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...

    Private Sub Repeater1_ItemD ataBound(ByVal sender As Object, ByVal e As System.Web.UI.W ebControls.Repe aterItemEventAr gs) Handles Repeater1.ItemD ataBound
    If (e.Item.ItemTyp e = ListItemType.It em) Then
    CType(e.Item.Fi ndControl("fili ng"), _
    filingControl). SetData(CType(e .Item.DataItem, _
    Data.DataRowVie w), False)
    End If
    If (e.Item.ItemTyp e = ListItemType.Al ternatingItem) Then
    CType(e.Item.Fi ndControl("fili ng"), _
    filingControl). SetData(CType(e .Item.DataItem, _
    Data.DataRowVie w), True)
    End If

    End Sub
    --------------------------------------------------------------------

    Public Sub SetData(ByVal dr As Data.DataRowVie w, ByVal IsAlternating As Boolean)

    Me.lbl_FAANo.Te xt = dr("FAA_Number" )
    Me.txtbx_Docume nts.Text = dr("Description ")
    Me.txtbx_FAAFee .Text = FormatCurrency( dr("FAA_Advance "), 2)
    Me.txtbx_AeroFe e.Text = FormatCurrency( dr("Aero_Fee") , 2)

    If IsAlternating Then
    Panel1.BackColo r = Drawing.Color.L ightGoldenrodYe llow
    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
    Last edited by jcas1411; Mar 13 '08, 06:33 AM. Reason: Moved to .NET, sorry
Working...