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_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
-
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
1 2241
Sweet, figured out my own problem after a little sleep. Basically my repeater didn't contain a datarowview object, it contained a UserControl that contained the datarowview object.... so my solution, add a getData() function in my user control and return the object it contains. In the codebehind for the form find user control and assign it to an object...workes and is clean. -
Function GetData() As objFilingDetails
-
Dim adetail As New objFilingDetails
-
adetail.FAA_Number = Me.lbl_FAANo.Text
-
adetail.Description = Me.txtbx_Documents.Text
-
adetail.FAA_Advance = Convert.ToDecimal(Me.txtbx_FAAFee.Text.Trim("(", "$", ")"))
-
adetail.Aero_Fee = Convert.ToDecimal(Me.txtbx_AeroFee.Text.Trim("(", "$", ")"))
-
-
Return adetail
-
End Function
-
-
'and in the codebehind
-
Dim details As New objFilingDetails
-
Dim item As RepeaterItem
-
For Each item In Repeater1.Items
-
-
details = CType(item.FindControl("filing"), filingControl).GetData()
-
objFiling.Details.Add(details)
-
-
Next
-
-
Sign in to post your reply or Sign up for a free account.
Similar topics
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...
|
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' + '<%#...
|
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...
|
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...
|
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:
...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |