如果条件不起作用并且没有错误消息

时间:2019-06-26 09:46:50

标签: vb.net

这似乎是一个非常奇怪的错误。如果lblSoldStatus.Text <>“ LIVE”那么它会正确重定向:response.redirect(“ selling.aspx?msgID = 3”)如果lblSoldStatus.Text等于其他任何内容,它都应执行删除代码,但不删除。真正奇怪的是,当我在IF语句的正上方添加一个陷阱.. Response.redirect(“ www.blablabla.co.uk”)时,如果lblSoldStatus.Text,它将尝试重定向到www.blablabla.co.uk。 <>“ LIVE”,但是如果lblSoldStatus.Text是其他内容,则不会重定向!该重定向陷阱位于IF语句之前。我没有任何错误。有人知道发生了什么吗?

Protected Sub lnkDelete_Click(sender As Object, e As System.EventArgs)
    Dim lnkDelete As ImageButton = CType(sender, ImageButton)
    Dim currentRow As GridViewRow = DirectCast(lnkDelete.Parent.Parent, GridViewRow)
    Dim hdnFilename As HiddenField = currentRow.FindControl("hdnFilename")

    Dim item As New items
    item.filename = hdnFilename.Value
    item.fileID = lnkDelete.CommandArgument.ToString
    Dim lblsoldStatus As Label = currentRow.FindControl("lblSoldStatus")

    Dim dateBoughtPlusTen As DateTime = AddTenToDateBought(item.fileID)

    'Response.redirect("www.blablabla.co.uk")

    If lblSoldStatus.Text<>"LIVE" AND date.now < dateBoughtPlusTen
        response.redirect("selling.aspx?msgID=3")
    Else
        'Delete Code
    End If
End Sub

0 个答案:

没有答案