基本上GridView中的AutoPostBack 事件皆可使用
前端ASPX
1.包asp:UpdatePanel
<asp:UpdatePanel ID="UpdatePanel12" runat="server" >
<ContentTemplate>
</ContentTemplate>
</asp:UpdatePanel>
2.在GridView的RadioButton裡宣告OnCheckedChanged,AutoPostBack="true"
EX:OnCheckedChanged="opt_CheckedChanged" AutoPostBack ="true"
後端
Protected Sub
opt_CheckedChanged (ByVal sender As Object, ByVal e As EventArgs)
Try
Dim tempRadioButton As New RadioButton
tempRadioButton = CType(sender, RadioButton)
Dim gvRow As GridViewRow
gvRow = CType(tempRadioButton.NamingContainer, GridViewRow)
If Not (gvRow Is Nothing) Then
Dim index As Integer = gvRow.RowIndex
For i As Integer = 0 To
GridView名稱.Rows.Count - 1
If i <> index Then
If CType(
GridView名稱.Rows(i).Cells(0).FindControl("RadioButton名稱"), RadioButton).Checked Then
CType(
GridView名稱 .Rows(i).Cells(0).FindControl("
RadioButton名稱 "), RadioButton).Checked = False
End If
End If
Next
End If
Catch ex As Exception
End Try
End Sub