我试图在 Visual Studio vb 的 Web 表单上做一些警报消息,但是当我尝试在操作方法中动态编码它时,它一直给我这个错误“只有内容控件被直接允许在包含内容控件的内容页面中”
我把旧代码留在了它只是在 HTML 中生成标签错误消息的地方
在这条线下方得到一条蓝色波浪线
popupScript = "<script language='javascript'>" + "showErrorToast();" + "</script>"
jQuery 函数
<script type="text/javascript">
function showErrorToastr() {
toastr.warning('Please enter at least 3 characters of the organisation name')
}
取消按钮单击时的Vb动作方法
Protected Sub btnSelect0_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim popupScript As String = ""
If txtorgname.Text = "" Then
lblerror.Text = "Please enter at least 3 characters of the organisation name"
txtorgname.Focus()
popupScript = "<script language='javascript'>" + "showErrorToast();" + "</script>"
ElseIf Len(txtorgname.Text) < 3 Then
lblerror.Text = "Please enter at least 3 characters of the organisation name"
txtorgname.Focus()
ElseIf Len(txtorgname.Text) > 50 Then
lblerror.Text = "Organisation name too long. Max 50"
txtorgname.Focus()
Else
BindData()
End If
End Sub