您好,我有一点问题,或者我应该说一个给我带来很多头痛的巨大问题。我在vb.net编写在线考试申请表。我注意到,如果单选按钮的文本非常长,则SelectedIndexchanged事件不会触发。不知道为什么会这样。但是当我减少文本长度时,事件会按预期触发。我需要举办活动,因为这是我如何保存参加考试的参与者的选定答案选择
Dim i As Integer = CType(Session("i"), Integer)
Dim index As Integer = rad.SelectedIndex
''here am checking if the person has already answered the question
''the person has already answered the question so projct answer back
Dim myAns As New SerializableDictionary(Of Integer, Integer)
''am saving back the answer that the idiot has just answerd
Dim xml_serializer As New _
XmlSerializer(GetType(SerializableDictionary(Of Integer, Integer)))
Using string_reader As New StringReader(Session("SVEnglish"))
myAns = DirectCast(xml_serializer.Deserialize(string_reader), _
SerializableDictionary(Of Integer, Integer))
End Using
If myAns.ContainsKey(i) Then
myAns.Remove(i)
myAns.Add(i, index)
Else
myAns.Add(i, index)
End If
''saving back to session
Dim savedAns As String = ""
Dim xml_serializer2 As New _
XmlSerializer(GetType(SerializableDictionary(Of Integer, Integer)))
Try
Using string_writer As New StringWriter()
xml_serializer.Serialize(string_writer, myAns)
savedAns = string_writer.ToString
Session("SVEnglish") = savedAns
string_writer.Close()
End Using
Catch ex As Exception
Stop
End Try
Dim selectAnswers As New SerializableDictionary(Of Integer, String)
Dim xml_serializerAnswers As New _
XmlSerializer(GetType(SerializableDictionary(Of Integer, String)))
Using string_reader As New StringReader(Session("SelAnswerEnglish"))
selectAnswers = DirectCast(xml_serializerAnswers.Deserialize(string_reader), _
SerializableDictionary(Of Integer, String))
End Using
If selectAnswers.ContainsKey(i) Then
selectAnswers.Remove(i)
selectAnswers.Add(i, rad.SelectedItem.Text)
Else
selectAnswers.Add(i, rad.SelectedItem.Text)
End If
Dim selAns2 As String = ""
Dim xml_serializerSavedAnswers As New _
XmlSerializer(GetType(SerializableDictionary(Of Integer, String)))
Try
Using string_writer As New StringWriter()
xml_serializerSavedAnswers.Serialize(string_writer, selectAnswers)
selAns2 = string_writer.ToString
Session("SelAnswerEnglish") = selAns2
string_writer.Close()
End Using
Catch ex As Exception
Stop
End Try
End Sub
这是在selectedindexchanged子例程中运行的代码。 radiobuttonlist从数据库中填充。任何帮助或建议都非常感谢