Dim SubID As String
For i As Integer = 0 To gvShowState.Rows.Count - 1
SubID = gvShowState.Rows(i).Cells(0).Text
Dim cmd As DataTable = connectdb.GetDataTable("SELECT * FROM Student_Grade WHERE Sub_id='" & SubID & "' AND Course_id='" & ddlSelectCourse.SelectedValue & "'")
If cmd.Rows.Count > 0 Then
'enable pass
Dim lblPass As Label = CType(e.Row.FindControl("lblPass"), Label)
If Not IsNothing(lblPass) Then
lblPass.Visible = True
lblPass.Text = "กรอกแล้ว"
End If
'disable notpass
Dim lblNot As Label = CType(e.Row.FindControl("lblNot"), Label)
If Not IsNothing(lblNot) Then
lblNot.Visible = False
End If
Else
'enable notpass
Dim lblNot As Label = CType(e.Row.FindControl("lblNot"), Label)
If Not IsNothing(lblNot) Then
lblNot.Visible = True
lblNot.Text = "ยังไม่ได้กรอก"
End If
'disable pass
Dim lblPass As Label = CType(e.Row.FindControl("lblPass"), Label)
If Not IsNothing(lblPass) Then
lblPass.Visible = False
End If
End If
Next
รูปนะคับ
จากรูปจะเห็นว่าผลมันคลาดเคลื่อนไป 1 บรรทัดอ่ะคับ
Tag : .NET, Ms SQL Server 2008, Web (ASP.NET), VB.NET, VS 2010 (.NET 4.x)