|
|
|
รบกวนหน่อยค่ะ เช็คว่าตอบ radiobutton ทุกข้อหรือยัง ถ้ายังให้เตือนก่อน บันทึกลงดาต้าเบส |
|
|
|
|
|
|
|
จะเช็คว่าได้กด radio button ทุกข้อหรือยัง ถ้ายัง เวลากด button1 ให้เตือนก่อนว่ายังตอบไม่ครบ
คำถามแต่ละข้อดึงมาจากดาต้าเบสค่ะ
Code (VBScript)
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
Dim chkCusID1 As RadioButton
Dim chkCusID2, chkCusID3, chkCusID4, chkCusID5, chkCusID6, chkCusID7, chkCusID8, chkCusID9 As RadioButton
Dim i As Integer
lblsCore.Text = ""
For i = 0 To GridView1.Rows.Count - 1
chkCusID1 = CType(GridView1.Rows(i).FindControl("c1"), RadioButton)
chkCusID2 = CType(GridView1.Rows(i).FindControl("c2"), RadioButton)
chkCusID3 = CType(GridView1.Rows(i).FindControl("c3"), RadioButton)
chkCusID4 = CType(GridView1.Rows(i).FindControl("c4"), RadioButton)
chkCusID5 = CType(GridView1.Rows(i).FindControl("c5"), RadioButton)
chkCusID6 = CType(GridView1.Rows(i).FindControl("c6"), RadioButton)
chkCusID7 = CType(GridView1.Rows(i).FindControl("c7"), RadioButton)
chkCusID8 = CType(GridView1.Rows(i).FindControl("c8"), RadioButton)
chkCusID9 = CType(GridView1.Rows(i).FindControl("c9"), RadioButton)
lblID = CType(GridView1.Rows(i).FindControl("lbl2"), Label)
If chkCusID1.Checked = True Then
'*** Have lblID.Text ***'
Me.lblsCore.Text = "1.00"
lblidcore.Text = lblID.Text
score = CDbl(lblsCore.Text)
' insertdetail()
ElseIf chkCusID2.Checked = True Then
'*** Have lblID.Text ***'
Me.lblsCore.Text = "1.50"
lblidcore.Text = lblID.Text
score = CDbl(lblsCore.Text)
' insertdetail()
ElseIf chkCusID3.Checked = True Then
'*** Have lblID.Text ***'
Me.lblsCore.Text = "2.00"
lblidcore.Text = lblID.Text
score = CDbl(lblsCore.Text)
' insertdetail()
ElseIf chkCusID4.Checked = True Then
'*** Have lblID.Text ***'
Me.lblsCore.Text = "2.50"
lblidcore.Text = lblID.Text
score = CDbl(lblsCore.Text)
' insertdetail()
ElseIf chkCusID5.Checked = True Then
'*** Have lblID.Text ***'
Me.lblsCore.Text = "3.00"
lblidcore.Text = lblID.Text
score = CDbl(lblsCore.Text)
' insertdetail()
ElseIf chkCusID6.Checked = True Then
'*** Have lblID.Text ***'
Me.lblsCore.Text = "3.50"
lblidcore.Text = lblID.Text
score = CDbl(lblsCore.Text)
' insertdetail()
ElseIf chkCusID7.Checked = True Then
'*** Have lblID.Text ***'
Me.lblsCore.Text = "4.00"
lblidcore.Text = lblID.Text
score = CDbl(lblsCore.Text)
' insertdetail()
ElseIf chkCusID8.Checked = True Then
'*** Have lblID.Text ***'
Me.lblsCore.Text = "4.50"
lblidcore.Text = lblID.Text
score = CDbl(lblsCore.Text)
'insertdetail()
ElseIf chkCusID9.Checked = True Then
'*** Have lblID.Text ***'
Me.lblsCore.Text = "5.00"
lblidcore.Text = lblID.Text
score = CDbl(lblsCore.Text)
' insertdetail()
End If
runid_core()
insertdetail()
Next
End Sub
Private Sub insertdetail()
Dim idhole As String = ""
Dim sum As Double = 0
Dim crsState As String = ""
Dim sqlAddCrs As String = ""
Dim sqlAddDtl As String = ""
Dim cmd As New SqlCommand
Dim dsChk As New DataSet
Dim addChk As Boolean = True
For i = 0 To GridView1.Rows.Count - 1
If i < GridView1.Rows.Count - 1 Then
Label10.Text = "ไม่ครบ"
Else
sqlAddCrs = "INSERT INTO Score_core VALUES('" & txtRunid.Text & "','" & lblidcore.Text & "','" & TextEvaluator.Text & "'," & lblsCore.Text & ",'" & TextEvaluatee.Text & "')"
Label8.Text = (sqlAddCrs)
Try
With cmd
.CommandType = CommandType.Text
.CommandText = sqlAddCrs
.Connection = conn
.ExecuteNonQuery()
End With
Catch ex As Exception
Label6.Text = ex.Message
Exit Sub
End Try
End If
Next
End Sub
Tag : .NET, Web (ASP.NET)
|
|
|
|
|
|
Date :
2013-06-26 08:00:07 |
By :
nuu |
View :
873 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
T_____________T
ไม่มีคัยตอบเลย รบกวนแนะนำหน่อย
If i < GridView1.Rows.Count - 1 Then
Label10.Text = "ไม่ครบ"
Else
ไม่เกี่ยวนะ ลองใส่แต่ใช่ไม่ได้
|
|
|
|
|
Date :
2013-06-26 14:09:16 |
By :
nuu |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|