Asp.net 在VB.NET中显示警报消息
在我的服务器端代码中,我需要显示一条警告消息,并在满足特定条件时停止页面的执行。执行停止,但我没有收到警报消息。我错过了什么?我的代码是这样的Asp.net 在VB.NET中显示警报消息,asp.net,alert,Asp.net,Alert,在我的服务器端代码中,我需要显示一条警告消息,并在满足特定条件时停止页面的执行。执行停止,但我没有收到警报消息。我错过了什么?我的代码是这样的 Try If txtAmtRequested.Text > Val(HiddenTotalFeeAmount.Value) Then ScriptManager.RegisterClientScriptBlock(Me, GetType(Page), UniqueID, "javasc
Try
If txtAmtRequested.Text > Val(HiddenTotalFeeAmount.Value) Then
ScriptManager.RegisterClientScriptBlock(Me, GetType(Page), UniqueID,
"javascript:alert('Total Fee Amount set for this student is - '" & HiddenTotalFeeAmount.Value & "'... Enter Concession Amount lesser than this one..!')", True)
Exit Function
End If
Catch ex As Exception
End Try
试试这个:
Try
If txtAmtRequested.Text > Val(HiddenTotalFeeAmount.Value) Then
ScriptManager.RegisterClientScriptBlock(Me, GetType(Page), UniqueID,
"javascript:alert('Total Fee Amount set for this student is - " & HiddenTotalFeeAmount.Value & "... Enter Concession Amount lesser than the..!');", True)
Exit Function
End If
Catch ex As Exception
End Try
在插入值时,您在javascript中结束了字符串,导致以下javascript:
javascript:alert('Total Fee Amount set for this student is - ' <Value> '... Enter Concession Amount lesser than the..!');
javascript:alert('为该学生设置的总费用金额为-'',请输入低于..的优惠金额!');
与此相反,您必须将值直接插入字符串,或在字符串中添加“+”:
javascript:alert('Total Fee Amount set for this student is - <Value> ... Enter Concession Amount lesser than the..!');
javascript:alert('为该学生设置的总费用金额为-…输入低于..的优惠金额!');
或
javascript:alert('为该学生设置的总费用金额为-'+'…输入低于..!'的优惠金额);
javascript:alert('Total Fee Amount set for this student is - ' + <Value> + '... Enter Concession Amount lesser than the..!');