I'm a still new to the whole creating a website please understand and explain in simple terms.
Ok, so there's a formview called FormView1 and another formview called User. In FormView1 I have a data called CoinEarn and the other formview data called CurrentCoin (from different formview)
I want to update CurrentCoin through a session so I could put it on my update SQL (by Session("CurrentCoin") = CurrentCoin + CoinEarn) after clicking a button (which is placed inside FormView1 template). In the code I gave the button the command name "complete".
Since CurrentCoin is from a different SQL and formview I need to reference/call up the specific data (CurrentCoin) so I can make the session.
I'm not sure if my thought/solution on this problem is correct or not (by calling up data or make a session to update CurrentCoin) but the main objective is to make CurrentCoin += CoinEarn after clicking a button.
Please help me! I've been trying to find the answer but it's too complicated to understand in proper websites.
Protected Sub FormView1_ItemCommand(sender As Object, e As FormViewCommandEventArgs) Handles FormView1.ItemCommand
If e.CommandName = "complete" Then
Dim row As FormViewRow = FormView1.Row
Dim TaskstatusLabel As Label = CType(row.FindControl("TaskStatusLabel"), Label)
Dim what As String = TaskstatusLabel.Text
Dim TaskCoin As Label = CType(row.FindControl("CoinEarnLabel"), Label)
Dim Coin As String = TaskCoin.Text
''Session("CurrentcoinSession") = Coin + CurrentCoin
Dim TaskstatusLabelID As Label = CType(row.FindControl("TaskIDLabel"), Label)
Dim whatTaskID As String = TaskstatusLabelID.Text
Session("TaskIDSession") = whatTaskID
If TaskstatusLabel.Text = "Complete" Then
Session("TaskStatusSession") = "Incomplete"
ElseIf TaskstatusLabel.Text = "Incomplete" Then
Session("TaskStatusSession") = "Complete"
End If
SqlDsStatus1.Update()
FormView1.DataBind()
End If
End Sub
Use of session CurrentCoin optional: Session("CurrentCoin") = ((Label)MyFormView.FindControl("lblCurrentCoin")).Text
Session("CurrentcoinSession") = Coin + Session("CurrentCoin")