 |
|
ช่วยเพิ่มเติมหน่อยครับ เลือก radiobutton ในgridview โดยทำทีละ row คือทำทีละข้อ กดข้อ1 แล้วข้อ2กดต่อได้
ทำทีละข้อลงมาเรื่อยๆ เป็นฟังก์ชั่นก็ได้คับ radioutton มี10อัน แต่ละอันอยู่คนละฟิวล์กัน

โค้ด
Code (VB.NET)
Public Function SaveGrid(ByVal objGv As GridView, ByVal newID As Integer) As Boolean
Dim gvr As GridViewRow
Dim i As Integer = 0
Dim Score As Integer
Dim gvComment As String
Dim Radioname As String
Dim Textboxname As String
With objGv
For Each gvr In .Rows
Dim rd10 As RadioButton
Radioname = .ID & "_10"
rd10 = CType(.Rows(i).FindControl(Radioname), RadioButton)
'Label10.Text += CStr(rd10.Checked).ToString & "<br>"
If rd10.Checked Then
'Label14.Text += .Rows(i).Cells(0).Text & rd10.Checked
'Label13.Text += "10,"
Score = 10
End If
Dim rd9 As RadioButton
Radioname = .ID & "_9"
rd9 = CType(.Rows(i).FindControl(Radioname), RadioButton)
If rd9.Checked Then
Score = 9
End If
Dim rd8 As RadioButton
Radioname = .ID & "_8"
rd8 = CType(.Rows(i).FindControl(Radioname), RadioButton)
If rd8.Checked Then
Score = 8
End If
Dim rd7 As RadioButton
Radioname = .ID & "_7"
rd7 = CType(.Rows(i).FindControl(Radioname), RadioButton)
If rd7.Checked Then
Score = 7
End If
Dim rd6 As RadioButton
Radioname = .ID & "_6"
rd6 = CType(.Rows(i).FindControl(Radioname), RadioButton)
If rd6.Checked Then
Score = 6
End If
Dim rd5 As RadioButton
Radioname = .ID & "_5"
rd5 = CType(.Rows(i).FindControl(Radioname), RadioButton)
If rd5.Checked Then
Score = 5
End If
Dim rd4 As RadioButton
Radioname = .ID & "_4"
rd4 = CType(.Rows(i).FindControl(Radioname), RadioButton)
If rd4.Checked Then
Score = 4
End If
Dim rd3 As RadioButton
Radioname = .ID & "_3"
rd3 = CType(.Rows(i).FindControl(Radioname), RadioButton)
If rd3.Checked Then
Score = 3
End If
Dim rd2 As RadioButton
Radioname = .ID & "_2"
rd2 = CType(.Rows(i).FindControl(Radioname), RadioButton)
If rd2.Checked Then
Score = 2
End If
Dim rd1 As RadioButton
Radioname = .ID & "_1"
rd1 = CType(.Rows(i).FindControl(Radioname), RadioButton)
If rd1.Checked Then
Score = 1
End If
Dim rd0 As RadioButton
Radioname = .ID & "_0"
rd0 = CType(.Rows(i).FindControl(Radioname), RadioButton)
If rd0.Checked Then
Score = 0
End If
Dim txtcomment As TextBox
Textboxname = .ID & "_comment"
txtcomment = CType(.Rows(i).FindControl(Textboxname), TextBox)
If rd0.Checked Then
'Label14.Text += .Rows(i).Cells(0).Text & "0"
'Label13.Text += "0"
gvComment = (.ID & "_comment").ToString
End If
'ds = CType(Session("ds"), DataSet)
'ds2 = CType(Session("ds"), DataSet)
Select Case objGv.ID
Case "gvchk1"
Me.AddInspectDetail(newID, CInt(gvr.Cells(0).Text), Score, txtcomment.Text)
Case "gvchk2"
'i = i
'Dim teststr As String = gvr.Cells(0).Text
Me.AddInspectDetail(newID, CInt(gvr.Cells(0).Text), Score, txtcomment.Text)
Case "gvchk3"
Me.AddInspectDetail(newID, CInt(gvr.Cells(0).Text), Score, txtcomment.Text)
Case "gvchk4"
Me.AddInspectDetail(newID, CInt(gvr.Cells(0).Text), Score, txtcomment.Text)
End Select
'Me.AddInspectDetail(newId, CType(ds.Tables(0).Rows(i)("ItemID").ToString, Integer), Score)
i += 1
Next
.Enabled = False
End With
End Function
Tag : .NET, Web (ASP.NET), VB.NET
|
|
 |
 |
 |
 |
Date :
2011-07-05 13:58:01 |
By :
mamanakin |
View :
1305 |
Reply :
4 |
|
 |
 |
 |
 |
|
|
|
 |