I am facing problem in passing data from one page to another. When i add values into the database on the button click, i have to pass current datetime value to the another page, m aslo storing that datetime in database.
But when i am passing values, its only showing 12:00:00 AM on the 2nd page, not the original datetime.
Page1 Code:
Protected Sub btnAddSignal_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddSignal.Click
Page.Validate()
If IsValid Then
'use to for email alerts
Dim isUpdateing As Boolean = False
Dim objCur As New CurrencyItem()
If intSigID.Value > 0 Then
isUpdateing = True
objCur.LoadSignal(intSigID.Value)
End If
objCur.CurID = CurID
objCur.DateAdded = Now
'objCur.SigID = SigID
objCur.Mode = drpMode.SelectedValue
objCur.Destination = TxtDestination.Text
objCur.DayType = drpDayType.SelectedValue
objCur.Trigger = txtTrigger.Text
objCur.StopLoss = txtStopLoss.Text
objCur.Destination = TxtDestination.Text
objCur.Comment = txtComment.Text
objCur.IsActive = True
'objCur.StopLossPosition = rdStopLossPosition.SelectedValue
objCur.TriggerAscending = chkTriggerAscending.Checked
objCur.TriggerDescending = chkTriggerDescending.Checked
objCur.MarketRate = txtMarketRate.Text
objCur.UpdateSignal()
'chkTriggerAscending
'chkTriggerDescending
intSigID.Value = objCur.SigID
SigID = objCur.SigID
'Process item
CallProcessPage()
'Make everything read only
btnAddSignal.Visible = False
If objCur.Mode = SignalMode.Buying Then
'Disable UnNeededbuttons
btnHoldLong.Visible = True
btnExitLong.Visible = True
btnBuyMarket.Visible = True
End If
If objCur.Mode = SignalMode.Selling Then
btnExitShort.Visible = True
btnHoldShort.Visible = True
btnSellMarket.Visible = True
End If
'do mails
Dim objproccess As New ProcessSignal()
If isUpdateing Then
'If updating
objproccess.CommunicateUpdates(New Ticker(objCur.PairCode), objCur, AlertType.Updated)
Else
'If adding
objproccess.CommunicateUpdates(New Ticker(objCur.PairCode), objCur, AlertType.Created)
End If
Response.Redirect("dispatch.aspx?DateAdded=" & objCur.DateAdded)
End If
End Sub
Page 2 Code:
Function TradeData(ByVal PairCode As String) As String
Dim DisplayDate As Date
DisplayDate = Convert.ToDateTime(Request.QueryString("DateAdded"))
Dim objTick As New Ticker(PairCode)
Return DisplayDate & " : " & objTick.TradeValueLast.ToString
End Function
But when i am passing values, its only showing 12:00:00 AM on the 2nd page, not the original datetime.
Page1 Code:
Protected Sub btnAddSignal_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddSignal.Click
Page.Validate()
If IsValid Then
'use to for email alerts
Dim isUpdateing As Boolean = False
Dim objCur As New CurrencyItem()
If intSigID.Value > 0 Then
isUpdateing = True
objCur.LoadSignal(intSigID.Value)
End If
objCur.CurID = CurID
objCur.DateAdded = Now
'objCur.SigID = SigID
objCur.Mode = drpMode.SelectedValue
objCur.Destination = TxtDestination.Text
objCur.DayType = drpDayType.SelectedValue
objCur.Trigger = txtTrigger.Text
objCur.StopLoss = txtStopLoss.Text
objCur.Destination = TxtDestination.Text
objCur.Comment = txtComment.Text
objCur.IsActive = True
'objCur.StopLossPosition = rdStopLossPosition.SelectedValue
objCur.TriggerAscending = chkTriggerAscending.Checked
objCur.TriggerDescending = chkTriggerDescending.Checked
objCur.MarketRate = txtMarketRate.Text
objCur.UpdateSignal()
'chkTriggerAscending
'chkTriggerDescending
intSigID.Value = objCur.SigID
SigID = objCur.SigID
'Process item
CallProcessPage()
'Make everything read only
btnAddSignal.Visible = False
If objCur.Mode = SignalMode.Buying Then
'Disable UnNeededbuttons
btnHoldLong.Visible = True
btnExitLong.Visible = True
btnBuyMarket.Visible = True
End If
If objCur.Mode = SignalMode.Selling Then
btnExitShort.Visible = True
btnHoldShort.Visible = True
btnSellMarket.Visible = True
End If
'do mails
Dim objproccess As New ProcessSignal()
If isUpdateing Then
'If updating
objproccess.CommunicateUpdates(New Ticker(objCur.PairCode), objCur, AlertType.Updated)
Else
'If adding
objproccess.CommunicateUpdates(New Ticker(objCur.PairCode), objCur, AlertType.Created)
End If
Response.Redirect("dispatch.aspx?DateAdded=" & objCur.DateAdded)
End If
End Sub
Page 2 Code:
Function TradeData(ByVal PairCode As String) As String
Dim DisplayDate As Date
DisplayDate = Convert.ToDateTime(Request.QueryString("DateAdded"))
Dim objTick As New Ticker(PairCode)
Return DisplayDate & " : " & objTick.TradeValueLast.ToString
End Function