gpt4 book ai didi

asp.net - 在 VB.NET 中显示警报消息

转载 作者:行者123 更新时间:2023-12-04 04:32:23 25 4
gpt4 key购买 nike

在我的服务器端代码中,我需要显示一条警报消息并在满足特定条件时停止页面的执行。执行停止,但我没有收到警报消息。我错过了什么?我的代码是这样的。

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..!');

关于asp.net - 在 VB.NET 中显示警报消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20371168/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com