daniel50096230
August 11th, 2009, 01:54 AM
I have the following code in my vb.net:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Start Bind PO Details and Trailers
dsRepeater = RetrieveDCDetails(Session.Item("UserID"), Session.Item("DCNo"))
dsRepeater.EnforceConstraints = False
' Add Relationship
rel = New DataRelation("DCDetailsTrailersRel",dsRepeater.Tables("DCAllowanceDetails").Columns("DCID"),
dsRepeater.Tables("DCallowanceTrailers1").Columns("DCID"))
dsRepeater.Relations.Add(rel)
rel = New DataRelation("DCDetailsTrailersRel2",dsRepeater.Tables("DCAllowanceDetails").Columns("SubLineNo2"), dsRepeater.Tables("DCAllowanceTrailers1").Columns("SubLineNo2"))
dsRepeater.Relations.Add(rel)
RepDCDetails.DataSource = dsRepeater.Tables("DCAllowanceDetails").DefaultView
RepDCDetails.DataBind()
'Update Status From Unread to Read to database
End If
Catch ex As Exception
End Try
End Sub
Private Function RetrieveDCDetails(ByVal callerUserID As String, ByVal DCID As String) As DataSet
Dim objDB As New clsDB
Try
Dim sql As String = [String].Empty
sql = "SELECT * FROM Trn_DC_Details "
sql &= "WHERE DCID='" + DCID + "' ORDER BY [LineNo] ;"
sql &= "SELECT * FROM Trn_DC_Trailers "
sql &= "WHERE DCID='" + DCID + "' ORDER BY [SubLineNo2] ;"
objDB.OpenDataSet(dsRepeater, sql)
dsRepeater.Tables(0).TableName = "DCAllowanceDetails"
dsRepeater.Tables(1).TableName = "DCAllowanceTrailers1"
dsRepeater.DataSetName = "DCAllowanceDetails"
Return dsRepeater
Catch e As Exception
Finally
objDB = Nothing
End Try
End Function 'RetrievePurchaseOrderDetails
Then I have the following repeater in my web layout:
<asp:Repeater runat="server" id="RepDCDetails">
<ItemTemplate>
<tr><td style="border-bottom: 1px; border-right-style: none;">
<asp:Label ID="Label17" runat="server" Text="<br/>"></asp:Label></td></tr>
<tr>
<td align="left" colspan="4" class="tableitem" width="7%" style="border-right: none; border-top: none; border-left: none; border-bottom: none; font-size: 9px; background-color:white" >
<%#Container.DataItem("ClassName")%>
</td>
</tr>
<tr><td align="right" colspan="1" class="tableitem" width="7%" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid; font-size: 9px;" >
<%#Container.DataItem("GRNNo")%></td>
<td align="right" colspan="1" class="tableitem" width="4%" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid; font-size: 9px;" >
<%#Format(DataBinder.Eval(Container.DataItem, "GRNDate"), "dd/MM/yy")%></td></tr>
<asp:Repeater runat="server" id="RepDCTrailers">
<ItemTemplate>
<tr>
<td align="center" colspan="4" class="tableitem" width="7%" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid; font-size: 9px;" >STYLE TOTAL</td>
<td align="left" colspan="1" class="tableitem" width="4%" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid; font-size: 9px;" >
<%#Container.DataItem("Style_RUnit")%></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
In the repeater, we can see that there are three item which are Class Name,GRNNo and Style_RUnit.Currently each GRNNo will display one ClassName and RUNit. But what I want is if the SubLineNo2 of GRNNo is same, then className and RUnit should only be display one time until the different SubLineNo2 of GRNNo occured.
Current Output:
Class1
GRN1
Style1
Class1
GRN2
Style1
Expected Output:
Class1
GRN1
GRN2
Style1
Class2
GRN3
GRN4
GRN5
Style2
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Start Bind PO Details and Trailers
dsRepeater = RetrieveDCDetails(Session.Item("UserID"), Session.Item("DCNo"))
dsRepeater.EnforceConstraints = False
' Add Relationship
rel = New DataRelation("DCDetailsTrailersRel",dsRepeater.Tables("DCAllowanceDetails").Columns("DCID"),
dsRepeater.Tables("DCallowanceTrailers1").Columns("DCID"))
dsRepeater.Relations.Add(rel)
rel = New DataRelation("DCDetailsTrailersRel2",dsRepeater.Tables("DCAllowanceDetails").Columns("SubLineNo2"), dsRepeater.Tables("DCAllowanceTrailers1").Columns("SubLineNo2"))
dsRepeater.Relations.Add(rel)
RepDCDetails.DataSource = dsRepeater.Tables("DCAllowanceDetails").DefaultView
RepDCDetails.DataBind()
'Update Status From Unread to Read to database
End If
Catch ex As Exception
End Try
End Sub
Private Function RetrieveDCDetails(ByVal callerUserID As String, ByVal DCID As String) As DataSet
Dim objDB As New clsDB
Try
Dim sql As String = [String].Empty
sql = "SELECT * FROM Trn_DC_Details "
sql &= "WHERE DCID='" + DCID + "' ORDER BY [LineNo] ;"
sql &= "SELECT * FROM Trn_DC_Trailers "
sql &= "WHERE DCID='" + DCID + "' ORDER BY [SubLineNo2] ;"
objDB.OpenDataSet(dsRepeater, sql)
dsRepeater.Tables(0).TableName = "DCAllowanceDetails"
dsRepeater.Tables(1).TableName = "DCAllowanceTrailers1"
dsRepeater.DataSetName = "DCAllowanceDetails"
Return dsRepeater
Catch e As Exception
Finally
objDB = Nothing
End Try
End Function 'RetrievePurchaseOrderDetails
Then I have the following repeater in my web layout:
<asp:Repeater runat="server" id="RepDCDetails">
<ItemTemplate>
<tr><td style="border-bottom: 1px; border-right-style: none;">
<asp:Label ID="Label17" runat="server" Text="<br/>"></asp:Label></td></tr>
<tr>
<td align="left" colspan="4" class="tableitem" width="7%" style="border-right: none; border-top: none; border-left: none; border-bottom: none; font-size: 9px; background-color:white" >
<%#Container.DataItem("ClassName")%>
</td>
</tr>
<tr><td align="right" colspan="1" class="tableitem" width="7%" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid; font-size: 9px;" >
<%#Container.DataItem("GRNNo")%></td>
<td align="right" colspan="1" class="tableitem" width="4%" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid; font-size: 9px;" >
<%#Format(DataBinder.Eval(Container.DataItem, "GRNDate"), "dd/MM/yy")%></td></tr>
<asp:Repeater runat="server" id="RepDCTrailers">
<ItemTemplate>
<tr>
<td align="center" colspan="4" class="tableitem" width="7%" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid; font-size: 9px;" >STYLE TOTAL</td>
<td align="left" colspan="1" class="tableitem" width="4%" style="border-right: black 1px solid; border-top: black 1px solid; border-left: black 1px solid; border-bottom: black 1px solid; font-size: 9px;" >
<%#Container.DataItem("Style_RUnit")%></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
</asp:Repeater>
In the repeater, we can see that there are three item which are Class Name,GRNNo and Style_RUnit.Currently each GRNNo will display one ClassName and RUNit. But what I want is if the SubLineNo2 of GRNNo is same, then className and RUnit should only be display one time until the different SubLineNo2 of GRNNo occured.
Current Output:
Class1
GRN1
Style1
Class1
GRN2
Style1
Expected Output:
Class1
GRN1
GRN2
Style1
Class2
GRN3
GRN4
GRN5
Style2