我使用的所有onClick
和Buttons
的{{1}}方法都不会在第一次点击时触发,而页面会刷新。按钮在第二次单击时工作正常。
标记:
ImageButtons
VB代码:
<asp:ImageButton ID="yButton" runat="server" Height="56px" Text="" Width="269px" ImageUrl ="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcRRcyFHSX9PkLkdwxeABW8vxOcm0BXnXuoU6PB_UfeimATDkKz9Zg" style="margin-left: 0px" EnableViewState="false" CausesValidation="false" OnClick ="YesButton_Click"/>
此按钮也会在
Protected Sub YesButton_Click(sender As Object, e As EventArgs) Handles yButton.Click
MsgBox("yes button clicked" & answer)
FormStart.answer = 0
answer = 0
FormStart.answered.Insert(index, 0)
Dim form As FormStart
form = New FormStart()
GoBackButton.Visible = False
yButton.Visible = False
nButton.Visible = False
labelQ.Visible = False
Me.Visible = False
FormStart.index = index
FormStart.GoBack = False
FormStart.resumeTest = True
Server.Execute("FormStart.aspx")
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (GoBack) Then
GoBack = True
FormStart.GoBack = True
Dim form As FormStart
form = New FormStart()
Me.Visible = False
FormStart.resumeTest = True
Server.Execute("FormStart.aspx")
Else
FormStart.GoBack = False
AskQuestion(FormStart.quesList(FormStart.index))
End If
End Sub
上显示,如此
answer = 0
FormStart.answered.Insert(index, 0)
Dim form As FormStart
form = New FormStart()
GoBackButton.Visible = False
yButton.Visible = False
nButton.Visible = False
labelQ.Visible = False
Me.Visible = False
FormStart.index = index
FormStart.GoBack = False
FormStart.resumeTest = True
Server.Execute("FormStart.aspx")
End Sub