I have a working page but now I recreated it and it doesn't work. I need some help to figure out why.
The way it should work is when I check the checkbox and click a button it should fire the checkbox function and then the button function
Working code asp.net
<asp:CheckBox ID="Checkbox" runat="server" Text='<%# Eval("QuoteLine") %>' OnCheckedChanged="QuoteLine_CheckedChanged" ForeColor="Transparent" Font-Size="0.1" />
Codebhind
Private SelectLines As New List(Of String)
Protected Sub QuoteLine_CheckedChanged(sender As CheckBox, e As EventArgs)
If sender.Checked Then
SelectLines.Add(sender.Text)
'selectedLines = SelectLines
End If
End Sub
Protected Sub BPrehang_Click(sender As Object, e As EventArgs) Handles BPrehang.Click
Session.Remove("Type")
Session.Remove("Location")
Session.Remove("Quote")
If SelectLines IsNot Nothing Then
For Each Item In SelectLines
If Item IsNot Nothing Then
Dim QuoteLine = Applications.QuoteLine.GetQuoteLineByLineId(Item)
If QuoteLine IsNot Nothing Then
Response.Redirect("../New-Pages/NewPrehangConfiguration.aspx?QuoteNumberId=" & TQuoteNumber.Text & "&PrehangId=" & QuoteLine.PrehangListId)
End If
End If
Next
End If
Response.Redirect("../New-Pages/NewPrehangConfiguration.aspx?QuoteNumberId=" & TQuoteNumber.Text)
End Sub
Not working Code
Asp.net
<asp:CheckBox ID="Checkbox" runat="server" Text='<%# Eval("OrderLine")%>' OnCheckedChanged="OrderLine_CheckedChanged" ForeColor="Transparent" Font-Size="0.1" />
Code Behind
Private SelectLines As New List(Of String)
Protected Sub OrderLine_CheckedChanged(sender As CheckBox, e As EventArgs)
If sender.Checked Then
SelectLines.Add(sender.Text)
'selectedLines = SelectLines
End If
End Sub
Protected Sub BPrehang_Click(sender As Object, e As EventArgs) Handles BPrehang.Click
Session.Remove("Type")
Session.Remove("Location")
Session.Remove("Order")
Session.Add("Prehang", "True")
If SelectLines IsNot Nothing Then
For Each Item In SelectLines
If Item IsNot Nothing Then
Dim Order = Applications.OrderLine.GetOrderByOrderLine(Item)
If Order IsNot Nothing Then
Response.Redirect("../New-Pages/NewPrehangConfiguration.aspx?OrderNumber=" & TOrderNumber.Text & "&PrehangId=" & Order.PrehangListId, False)
End If
End If
Next
End If
Response.Redirect("../New-Pages/NewPrehangConfiguration.aspx?OrderNumber=" & TOrderNumber.Text, False)
End Sub
Aucun commentaire:
Enregistrer un commentaire