在服务器端代码中,我需要显示一条警报消息,并在满足特定条件时停止页面的执行。执行停止,但是我没有收到警报消息。我想念什么?我的代码是这样的。
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('Total Fee Amount set for this student is - <Value> ... Enter Concession Amount lesser than the..!');
要么
javascript:alert('Total Fee Amount set for this student is - ' + <Value> + '... Enter Concession Amount lesser than the..!');
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句