473,324 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

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

jcas1411
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 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_FA AFee"), TextBox)).Text)
details.Aero_Fee = Decimal.FromOACurrency((CType(dtrow.Item("txtbx_Ae roFee"), TextBox)).Text)
details.FAA_Number = (CType(dtrow.Item("lbl_FAANo"), Label)).Text

objFiling.Details.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_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
Mar 13 '08 #1
0 3201

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: David Bartosik - MS MVP | last post by:
I am wanting to display my data in columns horizontally across the page rather than vertically down the page to avoid scrolling. in other words rather than have column 1 column 2 I want...
2
by: John Holmes | last post by:
I am using radioButton controls in a data repeater and would like to incorporate the 'key' field into the 'id' attribute of the radioButton controls and name them something like: 'rad' + '<%#...
2
by: Steve | last post by:
Hi All I am trying to find a way of displaying data in a datatable in such a way that ALL rows (only about 5 - 10) are editable and are updated from a single button press. I thought the best way...
1
by: Dot net work | last post by:
Hello. I have an interesting data binding scenario: I have a repeater control. It repeats a typical custom web user control. I also have a collection object, and each collection element...
8
by: darrel | last post by:
*sigh*...I've asked this before, but have long forgotten the answer. In the past, I'd often use repeater controls, bind data to it, and then reference the data fields from within the repeater: ...
1
by: Greg Cyrus | last post by:
Hi, i have created a function to open a Databse by OLEDB and fill it into a System.Data.DataSet-Objekt by oleDBAdapter.Fill-Mehtod.. Now I want to assign this DataSet to a normal...
0
by: news_server.nc.rr.com | last post by:
How do i perform a databind on a web user control within a repeater or rather how can I access the datasource that is already bound? I have a web user control that displays a table of values (the...
7
by: charliewest | last post by:
Hello - I'm using a Repeater control to render information in a very customized grid-like table. The Repeater control is binded to a DataSet with several records of information. Within the...
1
by: coolego1 | last post by:
Hello, I am new to ASP.net programming. I know a bit about ASP, but not so much the new .NET framework. I have been playing with the data controls that are available, but I have not figured out...
3
by: Emma Middlebrook | last post by:
Hi there, I've been trying to implement a repeater control in an ASP.NET 2 page but I can't seem to get the layout exactly how I want and I'm not sure if it's something that I am doing wrong or...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.