I need to output my data in a grid fashion but some of the cells will
have more than 1 record, I have been wrestling with the best solution
for this.
I need data in this fashion:
rowheader col1 col2 col3 col4
row1 data data data data
data data
data
row2 data data data
I am migrating an existing app so if you really want to see how I need
to output the data:
http://206.191.16.142/psait_spila/lm.../report2_e.cfm
I have loaded my jurisdiction column into a repeater and the years into
a datalist so I have my shell.
<table cellSpacing=0 cellPadding=0 width="90%" border=1>
<tr>
<th>Jurisdictio n </th><asp:repeate r id=rptYear runat="server">
<itemtemplate >
<th>
<%# Container.DataI tem %>
</th>
</itemtemplate>
</asp:repeater></tr><asp:datalis t id=dljurList runat="server"
cellpadding="0" cellspacing="0" >
<itemtemplate >
<tr>
<td>
<%# Container.DataI tem %>
</td>
<td>
<!--some control to outpu data properly here
-->
</td>
</tr>
</itemtemplate>
</asp:datalist>
</table>
But I need help on how to get my data into the table, I have used
looping constructs to get my data ordered in the proper fashion but
databinding the row does not work...
Object reference not set to an instance of an object.
I'm trying to fill a repeater or datalist when the year matches the
jursidiction, plus I have nulls, plus I have multiple records for some
years. My oop skills are weak so I have been trying to do this in a
procedural fashion.. and it aint workin .. any oop experts that can
show me the way, any help would be appreciated..
My code behind:
Public Class report2
Inherits System.Web.UI.U serControl
Protected rm As ResourceManager
Private yearparam As Integer =
httpContext.Cur rent.Request.Qu eryString("dec" )
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
'Put user code to initialize the page here
'Setup the proper decade parameters
Dim YearArrList As New ArrayList (10)
'Setup the prov list for looping through later
Dim ProvArrList As New ArrayList
Dim ProvNameList As New ArrayList
Dim DBDataView As DataView
Dim stryear_from As String
Dim stryear_to As String
Dim intyear_from As String
Dim intyear_to As String
Dim i as Integer
Select Case yearparam
Case 1
'Declare strings to pass as db params
stryear_from = "1965/01/01"
stryear_to = "1974/12/31"
'Declare strings for array params
intyear_from = "1965"
intyear_to = "1974"
Case 2
stryear_from = "1975/01/01"
stryear_to = "1984/12/31"
intyear_from = 1975
intyear_to = 1984
End Select
For i = intyear_from to intyear_to
YearArrList.Add (i)
Next
rptYear.DataSou rce = YearArrList
rptYear.DataBin d ()
'************** *************** *************** *************** *************** *************
' Temporary DB stuff to move to ReportClass
Dim connection As OracleConnectio n = New
OracleConnectio n(Configuration Settings.AppSet tings("connecti onstring"))
connection.Open ()
'************** *************** *************** *************** *************** *************
'Get the provinces into the Arraylist
Dim rdrstoredParams (0) As OracleParameter
rdrstoredParams (0) = New OracleParameter ("provcur",
OracleDbType.Re fCursor, ParameterDirect ion.Output)
rdrstoredParams (0).Value = "provcur"
Dim provrdr As OracleDataReade r =
OracleHelperV2. ExecuteReader(c onnection, CommandType.Sto redProcedure,
"REPORT_MW_GETP ROVS_pkg.GETPRO VS",rdrstoredPa rams)
While provrdr.Read
ProvArrList.Add (provrdr("provi nce_id"))
If (Session("Langu age") Is "en-CA") Then
ProvNameList.Ad d (provrdr("engli sh_name"))
Else
ProvNameList.Ad d (provrdr("frenc h_name"))
End If
End While
ProvArrList.Ins ert (0,"1")
If (Session("Langu age") Is "en-CA") Then
ProvNameList.In sert (0,"Federal")
Else
ProvNameList.In sert (0,"Fédéral")
End If
dljurList.DataS ource = ProvNameList
dljurList.DataB ind ()
Dim storedParams(2) As OracleParameter
storedParams(0) = New OracleParameter ("datefrom",
OracleDbType.Va rchar2, ParameterDirect ion.Input)
storedParams(0) .Value = stryear_from
storedParams(1) = New OracleParameter ("dateto",
OracleDbType.Va rchar2, ParameterDirect ion.Input)
storedParams(1) .Value = stryear_to
storedParams(2) = New OracleParameter ("hourly_cursor ",
OracleDbType.Re fCursor, ParameterDirect ion.Output)
storedParams(2) .Value = "hourly_cur sor"
Dim rdr As OracleDataReade r =
OracleHelperV2. ExecuteReader(c onnection, CommandType.Sto redProcedure,
"REPORT_MW_HOUR LYADULT_pkg.GET _HOURLY_DATA",s toredParams)
Dim dset As Dataset =
OracleHelperV2. ExecuteDataset( connection, CommandType.Sto redProcedure,
"REPORT_MW_HOUR LYADULT_pkg.GET _HOURLY_DATA",s toredParams)
Dim x As String
Dim y As Integer
Dim n As String
For Each y in ProvArrList
For Each x in YearArrList
n = (x + 1)
n = "1/1/" & n
x = "1/1/" & x
Dim filterstatement As New StringBuilder
filterstatement .append ("effective_dat e >
#").Append(x).A ppend("#").Appe nd("And effective_date <
#").Append(n).A ppend("#").Appe nd("AND prov_prov_id = ").Append(y )
Dim Row As DataRow
Dim Filter As String = (filterstatemen t.ToString())
Dim MatchRows() As DataRow = dset.Tables("Ta ble").Select(Fi lter)
For Each Row In MatchRows
Response.Write( "<tr><td>" & Row("effective_ date").ToString () & "<br>" &
Row("minimum_wa ge_amount")& "<br>" & " " & Row("prov_prov_ id") &
"</td></tr>")
dlwagelist.Data Source = Row
dlwagelist.Data Bind ()
next
'rptwageinfo.Da taBind()
Next
Next
End Sub
End Class
End NameSpace
tia
dave