如果第 9 列中的值为 49,我想选中该复选框。
Protected Sub grdMyGrid1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles grdMyGrid.RowDataBound
If e.Row.Cells(9).Text = "49" Then
---- some code here -------
End If
End Sub
复选框的网格视图中的列:
<asp:TemplateField >
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:CheckBox ID="ckMyCheckbox" runat="server" />
</ItemTemplate>
</asp:TemplateField>