darshan
New member
- Joined
- Mar 23, 2021
- Messages
- 2
- Programming Experience
- 3-5
VB.NET:
Private Sub acdContracts_ItemDataBound(sender As Object, e As AccordionItemEventArgs) Handles acdContracts.ItemDataBound
Dim rptContractDetails
Dim dtcontractlines
Dim dvContractDetails As DataView
Dim strFilter As String
Dim iContractNumber As Integer
Dim drvContract As DataRowView
Dim lblSale, lblPurch, lblTotalDifference As Label
Dim bolShowSo, bolshowPo As Boolean
Dim csc As ContractStatusCodes
If rblContractType.SelectedValue = "SO" Then
bolShowSo = True
bolshowPo = False
Else
bolShowSo = False
bolshowPo = True
End If
If e.ItemType = AccordionItemType.Header Then
lblPurch = e.AccordionItem.FindControl("lblPurchNum")
lblSale = e.AccordionItem.FindControl("LblSaleNum")
lblPurch.Visible = bolshowPo
lblSale.Visible = bolShowSo
lblTotalDifference = e.AccordionItem.FindControl("lblTotalDifference")
DirectCast(e.AccordionItem.FindControl("lblHeaderPurchStatus"), Label).Visible = bolshowPo
DirectCast(e.AccordionItem.FindControl("lblHeaderSaleStatus"), Label).Visible = bolShowSo
If Convert.ToInt64(lblTotalDifference.Text.Replace(",", "")) < 0 Then
lblTotalDifference.CssClass = "Validationerror"
End If
csc = DirectCast(e.AccordionItem.FindControl("lblHeaderPurchStatus"), Label).Text
If csc = ContractStatusCodes.ClosedByUser Then
DirectCast(e.AccordionItem.FindControl("lblHeaderPurchStatus"), Label).Text = "Closed"
DirectCast(e.AccordionItem.FindControl("lblHeaderFunction"), Label).Text = "Reopen"
Else
DirectCast(e.AccordionItem.FindControl("lblHeaderPurchStatus"), Label).Text = csc.ToString
End If
'lblHeaderSaleStatus
csc = DirectCast(e.AccordionItem.FindControl("lblHeaderSaleStatus"), Label).Text
If csc = ContractStatusCodes.ClosedByUser Then
DirectCast(e.AccordionItem.FindControl("lblHeaderSaleStatus"), Label).Text = "Closed"
Else
DirectCast(e.AccordionItem.FindControl("lblHeaderSaleStatus"), Label).Text = csc.ToString
End If
If rblContractType.SelectedValue = "PO" Then
DirectCast(e.AccordionItem.FindControl("lblName"), Label).Text = "Supplier"
If DirectCast(Session(ContractHeaderSessionName), DataTable).Select("PurchNum = " & lblPurch.Text)(0).Item("SupplierName").ToString <> DBNull.Value.ToString Then
DirectCast(e.AccordionItem.FindControl("lblNameData"), Label).Text = DirectCast(Session(ContractHeaderSessionName), DataTable).Select("PurchNum = " & lblPurch.Text)(0).Item("SupplierName")
End If
Else
DirectCast(e.AccordionItem.FindControl("lblName"), Label).Text = "Consumer"
If DirectCast(Session(ContractHeaderSessionName), DataTable).Select("SaleNum = " & lblSale.Text)(0).Item("ConsumerName").ToString <> DBNull.Value.ToString Then
DirectCast(e.AccordionItem.FindControl("lblNameData"), Label).Text = DirectCast(Session(ContractHeaderSessionName), DataTable).Select("SaleNum = " & lblSale.Text)(0).Item("ConsumerName")
End If
End If
ElseIf e.ItemType = AccordionItemType.Content Then
dtcontractlines = Session(ContractLineSessionName)
drvContract = e.Item
rptContractDetails = e.AccordionItem.FindControl("rptContractDetails")
If drvContract.Item("ContractType") = "PO" Then
iContractNumber = drvContract.Item("PurchNum")
strFilter = "PurchNum = " & iContractNumber
Else
iContractNumber = drvContract.Item("SaleNum")
strFilter = "SaleNum = " & iContractNumber
End If
If Not rptContractDetails Is Nothing And iContractNumber > 0 And Not dtcontractlines Is Nothing Then
dvContractDetails = dtcontractlines.DefaultView
dvContractDetails.RowFilter = strFilter
rptContractDetails.DataSource = dvContractDetails
rptContractDetails.DataBind()
End If
End If
End Sub
Last edited by a moderator: