这是我的代码:
Private Sub BindGrid()
Dim dt As New DataTable()
dt.Columns.AddRange(New DataColumn(2) {New DataColumn("Id", GetType(Integer)), New DataColumn("Name", GetType(String)), New DataColumn("Country", GetType(String))})
dt.Rows.Add(1, "John Hammond", "United States")
dt.Rows.Add(2, "Mudassar Khan", "India")
dt.Rows.Add(3, "Suzanne Mathews", "France")
dt.Rows.Add(4, "Robert Schidner", "Russia")
dt.Rows.Add(5, "Name", "abc")
Dim dr As DataRow = dt.NewRow()
dt.Rows.Add(dr)
GridView1.DataSource = dt
GridView1.DataBind()
End Sub
我想添加另一个空白文本框列,我可以在其中编写内容并将其保存在数据库中。我该怎么做呢?感谢。
答案 0 :(得分:0)
<asp:TemplateField HeaderText="Title" SortExpression="Expr">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%#
Bind("FieldName") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>