不懂怎么回事,求救!
<script language= "VB " runat= "server "> Sub Search_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
dim url as string
if Searchbox.text= " " then
response.Write( " <script language=javascript> ") //不要红色的代码就不会出现错误!
response.Write( "window.alert( '请输入需要查找的药品名! '); ")
response.Write( " </script> ")
elseif Category.SelectedItem.Value= "default " then
url= "Search.aspx?Drugmerchant= "+Drugmerchant.SelectedItem.text
url &= "&Searchbox= "+Searchbox.text
response.Redirect(url)
elseif Category.SelectedItem.Value <> "default " then
url= "Search.aspx?Category= "+Category.SelectedItem.text
url &= "&Searchbox= "+Searchbox.text
url &= "&Drugmerchant= "+Drugmerchant.SelectedItem.text
response.Redirect(url)
End if
End Sub
</script>
出现的错误是:
编译器错误信息: BC30081: “If”必须以匹配的“End If”结束。
源错误:
行 2: Sub Search_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
行 3: dim url as string
行 4: if Searchbox.text= " " then
行 5: response.Write( " <script language=javascript> ")
行 6: response.Write( "window.alert( '请输入需要查找的药品名! ')
我想让在收索时没输入内容就提示他要输入内容,但用了红色那些代码,他就提示错误了,去掉红色的代码,程序可以正常运行!
这些代码是写在用户控件里的!
大家帮帮忙解决!!谢了!