我有一个工作页面,但现在我重新创建它并且它不起作用。我需要一些帮助来找出原因。
它的工作方式是当我选中复选框并单击一个按钮时,它应该激活复选框功能,然后按下按钮功能
工作代码 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
不工作代码
Asp.net
<asp:CheckBox ID="Checkbox" runat="server" Text='<%# Eval("OrderLine")%>' OnCheckedChanged="OrderLine_CheckedChanged" ForeColor="Transparent" Font-Size="0.1" />
背后的代码
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