Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) For Each item As DataListItem In DataList1.Items If item.ItemType = ListItemType.Item Or item.ItemType = ListItemType.AlternatingItem Then Dim questionid As Integer Dim choiceid As Integer = 0 Dim choicetext As String = "" questionid = CType(item.FindControl("Label3"), Label).Text Dim anstype As HiddenField = item.FindControl("HiddenField1") Select Case anstype.Value Case "S" Dim rbl As RadioButtonList = item.FindControl("RadioButtonList1") If rbl.SelectedValue = "" Then choiceid = 0 Else choiceid = rbl.SelectedValue End If SaveAnswer(questionid, choiceid, "") Case "M" Dim cbl As CheckBoxList = item.FindControl("CheckBoxList1") For i As Integer = 0 To cbl.Items.Count - 1 If cbl.Items(i).Selected Then choiceid = cbl.Items(i).Value Else 'MsgBox.show("Ve molime dopolnete gi site prasanja") End If SaveAnswer(questionid, choiceid, "") Next Case "T" Dim txt As TextBox = item.FindControl("TextBox1") choicetext = txt.Text SaveAnswer(questionid, 0, choicetext) End Select End If Next DataList1.Visible = False Label5.Text = "Ви благодариме за учеството во анкетата!" End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)