<asp:TemplateField HeaderText="姓名">
<ItemTemplate>
<asp:TextBox ID="txtName" runat="server" Text='<%# Eval("Name","{0}") %>'></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="身份證">
<ItemTemplate>
<asp:Label ID="lblID" runat="server" Text='<%# Eval("ID","{0}") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
If (e.Row.RowType = DataControlRowType.DataRow) Then
Dim lblID As Label = CType(e.Row.FindControl("lblID"), Label)
If lblID.Text.Trim() <> "" Then
e.Row.Enabled = False
End If
End Sub
留言列表