Else If 语句错误
Protected Sub s1click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles s1.Click
If s1.ImageUrl = "~/Images/available_seat_img.gif" Then
s1.ImageUrl = "~/Images/selected_seat_img.gif"
Button1.Enabled = True
TextBox1.Text = s1.ID.ToString() + ","
ElseIf s1.ImageUrl = "~/Images/selected_seat_img.gif" Then
' Button1.Enabled = False
s1.ImageUrl = "~/Images/available_seat_img.gif"
TextBox1.Text = TextBox1.Text.Replace("s1", "")
End If
End Sub
当我运行此代码时...第二个 Elseif 条件将不起作用... 这段代码片段有什么问题...
Protected Sub s1click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles s1.Click
If s1.ImageUrl = "~/Images/available_seat_img.gif" Then
s1.ImageUrl = "~/Images/selected_seat_img.gif"
Button1.Enabled = True
TextBox1.Text = s1.ID.ToString() + ","
ElseIf s1.ImageUrl = "~/Images/selected_seat_img.gif" Then
' Button1.Enabled = False
s1.ImageUrl = "~/Images/available_seat_img.gif"
TextBox1.Text = TextBox1.Text.Replace("s1", "")
End If
End Sub
when i run this code ... the second Elseif condition will not work...
whats the problem with this code snippet ...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该检查函数开始时设置的值(使用
MessageBox
或类似的东西)。这可能不是你所期望的。如果
s1.ImageUrl
设置为“~/Images/selected_seat_img.gif”
,那么它应该可以正常工作。You should check to see what the value is set to at the start of the function (with a
MessageBox
or something similar). It may not be what you expect.If
s1.ImageUrl
is set to"~/Images/selected_seat_img.gif"
, then it should work fine.