我怎样才能拥有一个自动生成文本框而不是标签的数据网格视图?
Dested
问问题
2303 次
1 回答
3
简而言之,你不能。您可以从 gridview 继承并自己实现它。它可能看起来像这样:
Public Class MyGrid
Inherits GridView
Private Sub MyGrid_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles Me.RowDataBound
If Me.AutoGenerateColumns = True Then
If e.Row.RowType = DataControlRowType.DataRow Then
For Each c As TableCell In e.Row.Cells
Dim tb As New TextBox()
tb.Text = c.Text
c.Controls.Clear()
c.Controls.Add(tb)
Next
End If
End If
End Sub
于 2009-02-06T21:12:22.737 回答